Open luke-biel opened 1 year ago
Yeah, it's clunky, however there's no better way without providing custom test harness.
So far we can consider crate
level, module
level and test
level configurations. Crate
level require something that can be guaranteed in static context, and this is best solution I could think of. Module
level would require to have written custom macro with module harness, and this is way to big of a task to do it now. For test
level I've already shown few workarounds with using
, with
or simply doing assertion comparison by yourself.
As for assert
being present - as I mentioned, we need something generic over different possible assertion crates. It's optional to override assert
, as shown in tests.
crate
level would certainly be most user-friendly, with a possible module
-level override option (not my use case, but I imagine this being useful).
I'm gonna fix tests in this and push it then.
I'd really avoid feature flags, as they tend to break when workspaces
are at play, plus it would anyway introduce dependency on pretty-assertions
, one that shouldn't break easily, but I had enough bad experience with insta
and broken transitive deps to avoid depending on other crates at all cost.
I don't really see a better option without using nightly or forcing a custom test harness. Maybe in the future I can replace this once something new shows up in rust. For time being unfortunately it has to be lib.rs
level macro.
Closes https://github.com/frondeus/test-case/issues/109 Closes https://github.com/frondeus/test-case/issues/84