Giter Site home page Giter Site logo

Comments (4)

la10736 avatar la10736 commented on June 23, 2024

Hi @ColinPitrat , thanks to report it.

trunk version at least point the issue by a meaningful error message:

   Compiling playground v0.1.0 (/home/michele/learning/rust/rstest/playground)
error: expected identifier or literal
 --> src/main.rs:7:6
  |
7 | case(-1.0, -1.0),
  |      ^

error: aborting due to previous error

I'll fix it ASAP but I cannot release the fix till the next version that I planned in the next month (I hope).

As work around you can use Unwrap("<arbitrary rust code>") syntax that should works as expected:

use rstest::rstest_parametrize;

#[rstest_parametrize(
input, expected,
case(0.0, 0.0),
case(1.0, 1.0),
case(Unwrap("-1.0"), Unwrap("-1.0")),
)]
fn identity(input: f64, expected: f64) {
    assert_eq!(input, expected);
}
michele@DartVader:~/learning/rust/ddddddd$ cargo test
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running target/debug/deps/ddddddd-0a92a75e7aec63ff

running 3 tests
test identity_case_2 ... ok
test identity_case_0 ... ok
test identity_case_1 ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

from rstest.

ColinPitrat avatar ColinPitrat commented on June 23, 2024

Thanks for the tip. On top of fixing it, I wonder if there would be a way to ensure this kind of failures don't go unnoticed. The good practice is to make a test fail before making it pass to avoid this kind of problem but it's easy to forget and not even notice that some tests are not running.

from rstest.

la10736 avatar la10736 commented on June 23, 2024

From the next release this kind of odd behavior should never happen. Every kind of wrong syntax or parsing errors will be reported.

from rstest.

la10736 avatar la10736 commented on June 23, 2024

General case will be traced in #19

from rstest.

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.