Skip to content

stdlib: add test discovery, extract test files - #8443

Merged
fdncred merged 6 commits into
nushell:mainfrom
presidento:std-tests
Mar 16, 2023
Merged

fdncred merged 6 commits into
nushell:mainfrom
presidento:std-tests

Conversation

@presidento

@presidento presidento commented Mar 14, 2023 •

Copy link
Copy Markdown
Contributor

Description

Was original asked here: #8405 (comment)
Make it easier to extend standard library with submodules.
(For a new submodule called xx.nu the tests can be written in test_xx.nu).
Test discovery is implemented.

User-Facing Changes

There are no user-facing changes.

Tests + Formatting

Tests are updated.
There is no nufmt now.

@presidento presidento changed the title stdlib: extract test files stdlib: add test discovery, extract test files Mar 14, 2023
@presidento

Copy link
Copy Markdown
Contributor Author

Test discovery implemented in tests.nu:
image

@fdncred fdncred added the A:std-library Defining and improving the standard library written in Nu label Mar 14, 2023

@amtoine amtoine left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is truely amazing, love the idea and how it shows up when running nu tests.nu ❤️

i've got some proposition in comments, but mainly things i've gathered with time so, without a proper nufmt, i'm fine with yours and mine 😉

(just the newlines please to avoid having a monolothic for loop 😉 the rest is much more minor 👀)

thanks again 😊

@amtoine amtoine mentioned this pull request Mar 14, 2023
@presidento

Copy link
Copy Markdown
Contributor Author

Thank you for the review. I don't have strong preferences on them, so I tried to implement everything, please check it.

@codecov

codecov Bot commented Mar 14, 2023 •

Copy link
Copy Markdown

Codecov Report

Merging #8443 (46bf90e) into main (c7583ec) will decrease coverage by 0.08%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8443      +/-   ##
==========================================
- Coverage   68.13%   68.06%   -0.08%     
==========================================
  Files         620      621       +1     
  Lines       99723    99938     +215     
==========================================
+ Hits        67950    68023      +73     
- Misses      31773    31915     +142     

see 23 files with indirect coverage changes

@amtoine

amtoine commented Mar 15, 2023

Copy link
Copy Markdown
Member

Thank you for the review. I don't have strong preferences on them, so I tried to implement everything, please check it.

noishe, i always find more spaced code way easier to read 😌

that will have to be confirmed with nufmt when it's there of course 😉

@amtoine amtoine left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a thought i had about the grey color, not sure how it looks like not with the default theme 👍

@fdncred

fdncred commented Mar 16, 2023

Copy link
Copy Markdown
Contributor

Are we ready to land this one?

@fdncred
fdncred merged commit d74a260 into nushell:main Mar 16, 2023
@fdncred

fdncred commented Mar 16, 2023

Copy link
Copy Markdown
Contributor

Thanks

fdncred pushed a commit that referenced this pull request Mar 17, 2023
> **Warning**
> this PR is the result of a demand from the core team, to have the
simplest structure for the standard library, at least for now 👍

# Description
this PR mainly
- moved the `dirs.nu` module to the end of `std.nu`
- fixed the imports in `test_dirs.nu`

# User-Facing Changes
```
$nothing
```

# Tests + Formatting
with the new runner from #8443, we get as expected 👌 
```
>_ nu crates/nu-utils/standard_library/tests.nu
INFO  Run tests in test_dirs
DEBUG Run test test_dirs/test_dirs_command
INFO  Run tests in test_std
DEBUG Run test test_std/test_assert
DEBUG Run test test_std/test_match
DEBUG Run test test_std/test_path_add
```

# After Submitting
```
$nothing
```
fdncred pushed a commit that referenced this pull request Mar 18, 2023
# Description

```nushell
log critical "this is a critical message"
log error "this is an error message"
log warning "this is a warning message"
log info "this is an info message"
log debug "this is a debug message"
```


![image](https://user-images.githubusercontent.com/282320/225071852-1ddf0e87-d12b-452d-9598-5122df7123ab.png)

# Tests + Formatting

Tests are written. To run automatically, #8443 needs to be merged before
or after this PR.

---------

Co-authored-by: Mate Farkas <[email protected]>
@presidento
presidento deleted the std-tests branch April 6, 2023 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A:std-library Defining and improving the standard library written in Nu

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants