Coder Social home page Coder Social logo

Comments (3)

amtoine avatar amtoine commented on July 30, 2024 1

@fdncred
if you have a look at the test stdlib command in the toolkit.nu of Nushell, you'll see a simple

cargo run -- -c $"use std testing; testing run-tests --path crates/nu-std ($extra_args)"

that's basically all there is to it

  • you have some file somewhere
  • you define commands in that file, possibly exported
  • from the same file or another file, you add test commands with the #[test] annotation in their docstring
  • you run
use std testing; testing run-tests --path ...

you can also filter the modules and the tests to run with the options of run-tests in case there are a bunch 👍

from where the tests are defined you just need to make sure the definitions you tests are in scope, especially when they come from another file 😋

from nu_scripts.

amtoine avatar amtoine commented on July 30, 2024

good idea 👍

two thinks that come to mind

  • there might already be invalid scripts, i bet the CI won't be green directly
  • even though we cannot test externals, we can check the syntax and parse everything to completion 😌

from nu_scripts.

fdncred avatar fdncred commented on July 30, 2024

Now that you mention it, it seems like it would be super valuable to have a script per nushell nu-command crate command. I'd guess that those scripts would probably be better in the nushell repo though and maybe tested through the std-lib test facility?

As we move toward 1.0, having every parameter on every command tested seems like a good idea. I'd like to start on this but I'm not sure how to use the std-lib testing facility. @amtoine is there a good testing model to look at somewhere for this?

from nu_scripts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.