FEATURE: add the first draft of the standard library#8150
FEATURE: add the first draft of the standard library#8150fdncred merged 4 commits intonushell:mainfrom
Conversation
This commit implements the few commands we talked about in the dedicated discord channel, #standard-library: - the `assert` familly with a private helper `_assert` - a version of the `match` statement
Usage: ```bash nu crates/nu-utils/src/sample_config/tests.nu ```
📄 TODO:
|
|
Seems like a good start. It doesn't have to be perfect the first time. We'll continue to iterate. |
|
Perhaps |
This change has been proposed by @jmoore34 and validated by @fdncred, advocating better discoverability. Commands used: ```bash sd 'def assert_eq' 'def "assert eq"' crates/nu-utils/src/sample_config/std.nu sd '`assert_eq`' '`assert eq`' crates/nu-utils/src/sample_config/std.nu sd 'assert_eq' 'assert eq' crates/nu-utils/src/sample_config/tests.nu sd 'def assert_ne' 'def "assert ne"' crates/nu-utils/src/sample_config/std.nu sd '`assert_ne`' '`assert ne`' crates/nu-utils/src/sample_config/std.nu sd 'assert_ne' 'assert ne' crates/nu-utils/src/sample_config/tests.nu ```
no problem, i've changed that in 839d7bf 👍
gotcha 👌 |
|
mm how can i fix https://github.com/nushell/nushell/actions/runs/4260734684/jobs/7414370252? 😕 |
We removed the Windows coverage run for now as our setup was currently incompatible with the limited disk allocation on those workers. Should resolve by merging main. |
got it 👌 |
|
there it is, merged on very latest |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8150 +/- ##
=======================================
Coverage 68.87% 68.88%
=======================================
Files 617 617
Lines 99259 99259
=======================================
+ Hits 68362 68371 +9
+ Misses 30897 30888 -9
|
|
@sholderbach |
|
What is the general status? I would favour landing as soon as possible so potential bikeshedding can happen in their respective topical PRs. |
as been already said, that might be a good start, at least i've done what i had in mind for this very first PR 👍 |
|
Let's land this and keep building. |
Related to #8150, #8635 and #8632. # Description i've introduced a bad set of tests for the `assert equal` command in #8150... they should not compare `1 + 2` and `4)` or `3)` but the ints. in this PR, i remove this spurious parentheses that were not planned at all 😬 👀 # User-Facing Changes ``` $nothing ``` # Tests + Formatting ``` >_ nu crates/nu-utils/standard_library/tests.nu INF|2023-03-28T20:18:13.022|Running tests in test_asserts INF|2023-03-28T20:18:13.173|Running tests in test_dirs INF|2023-03-28T20:18:13.247|Running tests in test_logger INF|2023-03-28T20:18:13.473|Running tests in test_std ``` # After Submitting ``` $nothing ```
Related to nushell#8150, nushell#8635 and nushell#8632. # Description i've introduced a bad set of tests for the `assert equal` command in nushell#8150... they should not compare `1 + 2` and `4)` or `3)` but the ints. in this PR, i remove this spurious parentheses that were not planned at all 😬 👀 # User-Facing Changes ``` $nothing ``` # Tests + Formatting ``` >_ nu crates/nu-utils/standard_library/tests.nu INF|2023-03-28T20:18:13.022|Running tests in test_asserts INF|2023-03-28T20:18:13.173|Running tests in test_dirs INF|2023-03-28T20:18:13.247|Running tests in test_logger INF|2023-03-28T20:18:13.473|Running tests in test_std ``` # After Submitting ``` $nothing ```
hello there 👋 😋
as discussed over on the discord server, in
#standard-library, there is this new project of putting together a bunch of "standard" scripts and functions and propose anushell"standard library".this PR is the first one in that direction 🎉
Description
this PR implements the following few commands:
assertfamilly with a private helper_assertmatchstatementi've also added some examples in the docstrings of the functions 👍
User-Facing Changes
the standard library can now be used with
from the root of the
nushellsourceTests + Formatting
i've written a first draft of a
tests.numodule whichassertfamilly of function intest_assertteststhe tests are run with
through the
mainfunction and should give no error 👍After Submitting