You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0659]: test is ambiguous (glob import vs any other name from outer scope during import/macro resolution)
use test_case::test_case;use test_env_log::test;#[test_case(4, 2 ; "when operands are swapped")]#[test_case(-2, -4 ; "when both operands are negative")]#[test_case(2, 4 ; "when both operands are positive")]fnmultiplication_tests(x:i8,y:i8){let actual = (x * y).abs();assert_eq!(8, actual)}
cargo test
Compiling git-gamble v2.1.1-alpha.0 (/home/pinage404/Project/git-gamble)
error[E0659]: `test` is ambiguous (glob import vs any other name from outer scope during import/macro resolution)
--> tests/test_env_log_with_test_case.rs:4:1
|
4 | #[test_case(4, 2 ; "when operands are swapped")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name
|
note: `test` could refer to the attribute macro imported here
--> tests/test_env_log_with_test_case.rs:4:1
|
4 | #[test_case(4, 2 ; "when operands are swapped")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: consider adding an explicit import of `test` to disambiguate
= help: or use `self::test` to refer to this attribute macro unambiguously
note: `test` could also refer to the attribute macro defined here
--> /media/exec_downloaded/rust/rustup/toolchains/1.55.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:119:13
|
119 | pub use super::v1::*;
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `test_case` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0659`.
error: could not compile `git-gamble` due to previous error
How to use with test-case ?
The text was updated successfully, but these errors were encountered:
The issue exists because test-case is generating a super::* import and then Rust can't decide which test attribute to use, from the looks of it. If I adjust the test-case code as follows:
everything works fine. You will have to take that up with them.
In addition, what you are doing is not really how the crate is meant to be used with other attributes, as you can read here. Next time, I encourage you to do some research first.
I use
test-case
i tried to use
test-env-log
but i got the errorHow to use with test-case ?
The text was updated successfully, but these errors were encountered: