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
I have been playing with pretty_assertions and really like it. But when trying to use it with test-case I seem to get errors of ambiguity over assert_eq. Is it possible to use these two together?
error[E0659]: `assert_eq` is ambiguous (glob import vs any other name from outer scope during import/macro resolution)
--> src\squared\tests.rs:7:1
|
7 |#[test_case(5 => 25 ; "should be 25")]| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name
|
= note: `assert_eq` could refer to a macro from prelude
note: `assert_eq` could also refer to the macro imported here
--> src\squared\tests.rs:7:1
|
7 |#[test_case(5 => 25 ; "should be 25")]| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: consider adding an explicit import of `assert_eq` to disambiguate
= help: or use `self::assert_eq` to refer to this macro unambiguously
warning: unused import: `test_case::test_case`
--> src\guessing_game\tests.rs:3:5
|
3 | use test_case::test_case;| ^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
Here is the code. Uncommenting the pretty_assertions line gives the error above. Without it, it runs normally.
#[allow(unused_imports)]usecrate::squared::squared;//use pretty_assertions::assert_eq;#[cfg(test)]use test_case::test_case;#[test_case(5 => 25 ; "should be 25")]#[test_case(2 => 4 ; "should be 4")]fn squared_test(num:i32) -> i32{squared(num)
The text was updated successfully, but these errors were encountered:
Yea, I thought that could be related but wasn't sure how. That seemed much more in depth to what the library needed where here I am mainly looking for a sort of workaround for now.
This solution above should be easy enough as it can largely be updated by a couple find & replaces uses. thanks.
I have been playing with pretty_assertions and really like it. But when trying to use it with test-case I seem to get errors of ambiguity over
assert_eq
. Is it possible to use these two together?Here is the code. Uncommenting the
pretty_assertions
line gives the error above. Without it, it runs normally.The text was updated successfully, but these errors were encountered: