Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdlib: complete the test framework #8819

Closed
amtoine opened this issue Apr 8, 2023 · 10 comments
Closed

stdlib: complete the test framework #8819

amtoine opened this issue Apr 8, 2023 · 10 comments
Labels
enhancement New feature or request std-library Defining and improving the standard library written in nu and the core Rust ccommands tests issues to add tests or fix tests
Milestone

Comments

@amtoine
Copy link
Member

amtoine commented Apr 8, 2023

waiting for

resolved by

Related problem

cc/ @presidento

time to wrap up the testing framework, am i right? 😋

Note
comes from #8815 (comment)

Describe the solution you'd like

  • make the test runner a part of std
  • maybe use the following structure?
crates/nu-std/lib/
├── testing
│   ├── assert.nu
│   ├── run.nu
│   └── setup.nu
├── dirs.nu
├── ...
└── xml.nu

Describe alternatives you've considered

No response

Additional context and details

No response

@amtoine amtoine added the enhancement New feature or request label Apr 8, 2023
@sholderbach sholderbach added tests issues to add tests or fix tests std-library Defining and improving the standard library written in nu and the core Rust ccommands labels Apr 8, 2023
@presidento
Copy link
Contributor

I think it is important to be able to load everything from a submodule, I mean something like use asserts * to get every assert command. (Or similarly, use logger *.)

I would rename the assert module to asserts. (It was its original name, too.) And put the run module there with a describing name, like... hm... since Nushell has a run-external command, I would name it run-tests. (Although I like more run external and run tests, but the consistency has more value.)

@amtoine
Copy link
Member Author

amtoine commented Apr 9, 2023

I think it is important to be able to load everything from a submodule, I mean something like use asserts * to get every assert command. (Or similarly, use logger *.)

i think it's not possible right now with how the modules are nested 🤔
and it was not possible before as everything was in a single module 😮

if you try to use std dirs, that would give

Error: nu::parser::export_not_found

  × Export not found.
   ╭─[entry #1:1:1]
 1 │ use std dirs
   ·         ──┬─
   ·           ╰── could not find imports
   ╰────

for instance

@presidento
Copy link
Contributor

They had to be in a single module since bb8949f. I am glad that now they can be again in submodules. (Although they cannot be imported directly.) I agree that in current implementation it is not possible, also I think it would be preferable. Because we are going to have a standard library, not a standard book.

I do not want to expand the scope of this issue, you can create another one for discussing how to organize stdlib submodules.

For now I think we have to agree at least in the name of the test runner command.

@amtoine
Copy link
Member Author

amtoine commented Apr 10, 2023

They had to be in a single module since bb8949f. I am glad that now they can be again in submodules. (Although they cannot be imported directly.) I agree that in current implementation it is not possible, also I think it would be preferable. Because we are going to have a standard library, not a standard book.

👍

I do not want to expand the scope of this issue, you can create another one for discussing how to organize stdlib submodules.

it's already in the roadmap under "structuring the library" 😉

For now I think we have to agree at least in the name of the test runner command.

run-tests is ok for now 👍
that's a simple mv call and minor find/replace to change this to some other name, so the structure is the main focus 😋

@presidento
Copy link
Contributor

Okay. I'll create a PR after #8776 to move the runner into stdlib, named run-tests, and I'll update the documentation about testing.

@amtoine
Copy link
Member Author

amtoine commented Apr 10, 2023

Okay. I'll create a PR after #8776 to move the runner into stdlib, named run-tests, and I'll update the documentation about testing.

coool, looking forward to seing this then 😋

@amtoine
Copy link
Member Author

amtoine commented Apr 12, 2023

@presidento
do you think that this issue will be addressed once #8850 lands? 😋

if you want to work more on the test framework, i can add a task to the description above and we can let this open 😉

@presidento
Copy link
Contributor

Almost, just documentation is needed: nushell/nushell.github.io#868
Then we reach the MVP, so this will be addressed IMHO.

@amtoine
Copy link
Member Author

amtoine commented Apr 12, 2023

gotcha, that's great 👌

sholderbach pushed a commit that referenced this issue Apr 13, 2023
Move test runner to standard library.
Originated from #8819 

# After Submitting

I'll update the documentation about testing:
http://www.nushell.sh/book/testing.html

---------

Co-authored-by: Mate Farkas <Mate.Farkas@oneidentity.com>
@amtoine
Copy link
Member Author

amtoine commented Jul 21, 2023

i think this has been addressed with the PRs above 👍

@amtoine amtoine closed this as completed Jul 21, 2023
@hustcer hustcer added this to the v0.79.0 milestone Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request std-library Defining and improving the standard library written in nu and the core Rust ccommands tests issues to add tests or fix tests
Projects
None yet
Development

No branches or pull requests

4 participants