Comments (4)
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.
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.
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.
General case will be traced in #19
from rstest.
Related Issues (20)
- allow to run individual parametrized test cases from vscode? HOT 1
- Is a stable, 1.0 release planned HOT 7
- Include fixtures in separate files HOT 4
- Inject case description? HOT 2
- `Wrong case signature` error on pattern in function parameter HOT 1
- `rstest_reuse`: Compiler error of rstest_reuse 0.5.0 with rstest 0.18.0 and 0.18.1 HOT 6
- Access files in parent directory to a repo HOT 9
- Generate tests from json files HOT 2
- [question] Test with different specializations of a generic type? HOT 4
- '#[once]' cleanup after tests executed HOT 1
- `#[ignore]` at the top only applies to the first case HOT 3
- Consider supporting `wasm-bindgen-test` for async test HOT 3
- Allow customizing the "length" of the test case names from the path HOT 1
- Separating test input data & expected values? HOT 1
- Unable to silence lints HOT 1
- New #[files] feature does not recompile on file change HOT 5
- Consider allowing to rename the crate by passing an attribute `crate = ...` to the proc-macro HOT 9
- vscode/rust-analyzer "debug overlay action" not working anymore HOT 2
- Question: tests failed by memory allocation of x bytes failure` when only running many cases once HOT 2
- Allow `clippy::too_many_arguments` HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rstest.