test-case icon indicating copy to clipboard operation
test-case copied to clipboard

Does not fully work with `pretty_assertions`, fix OK?

Open vriesk opened this issue 2 years ago • 2 comments

Hoi,

If one uses assert_eq! or assert_ne! macros inside closures defined inside a #[test_case(...)], the drop-in replacement method provided by the pretty_assertions won't work, as the compilation fails on ambiguous resolution of those from use super::* here and the ::std provided one.

The solution would be to simply add a feature-guarded use ::pretty_assertions::{assert_eq, assert_ne} after the line above. Would not need test_case to depend on pretty_assertions even.

Would you accept a PR for that?

vriesk avatar Dec 07 '22 23:12 vriesk

Hi. Sorry that took so much time to answer, but I wanted to think about the issue and also review possible solutions. I'm not fond of adding a dependency or feature related to particular crates within test-case. I'm looking for something inbetween, where'd you define per-crate replacement for assert_eq and assert_ne macros, but I need to see how viable it is first. Will come back to you once I have a PoC, but if you have an opinion already, then it's most welcome.

luke-biel avatar Dec 14 '22 17:12 luke-biel

Can you review whether https://github.com/frondeus/test-case/pull/110/files#diff-2ba83ab0f8c146f86f4ed55a32bbd3557f337759f01dfb190562f56fe2167498 would solve your issue?

luke-biel avatar Dec 14 '22 19:12 luke-biel