3 ms·
Long time Go user, recently using rust as well. One of the things I miss most in rust are subtests and t.Errorf as opposed to t.Fatal. But perhaps I don't know
by ithkuil 3y ago
Long time Go user, recently using rust as well. One of the things I miss most in rust are subtests and t.Errorf as opposed to t.Fatal.
But perhaps I don't know how to do it. In most of the rust codebases I worked with tests contain sequences of asserts (the failure of which causes the whole test to fail). Procedural macros are often employed to create many smaller tests that seem to address the use case of table driven tests + t.Error or subtests.
Macros in rust are ... adequate, but there is something bout being able to just express your logic in your main language instead of having to fiddle with a macro language and effectively code generation.
Does anybody have good tips for bringing some of the enjoyable testing patterns from Go into Rust?
- randomdata 3y agoGo offering a delineation between "public" and "private" tests is also something sorrily lacking in other ecosystems.