Conversation
e31e709 to
89914c2
Compare
This introduces draw_named as the primitive for when we are actually printing, which provides much nicer output for values. It then makes the hegel::test macro automatically rewrite draw() to draw_named where it is safe to do so.
- Remove explicit 'a lifetime in is_tc_draw_binding (clippy::needless_lifetimes) - Move NOTE text outside ```no_run code fence in draw() doc comment - Allow clippy::let_and_return in closure test (needed for macro rewrite testing) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This mirrors Hypothesis's example decorator. It lets you explicitly provide a test case as a set of inputs to your test function. It will not work in all cases. Currently in some of those cases it will likely produce very bad error messages. I've tried to do my best to think of the common cases for this, but there are 100% going to be some missing ones that we can improve over time.
The proc macro always rewrites draw() to draw_named(), so draw() itself was never exercised in tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
These methods were unreachable through subprocess-based tests since coverage instrumentation doesn't capture subprocess output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
89914c2 to
fad5927
Compare
|
non-blocking thoughts: I think I think |
|
I agree Bit left field. How would you feel about |
|
I don't mind |
"explicitly provided test cases" still seems like the best noun to use here for me even if we don't want that in the attribute name. |
|
Oh BTW it's not strictly necessary, but it would be nice to get #163 merged first, as I think this has a natural rebuild on top of the backend system. It's implementation only though so the two can logically go in any order really. |
|
An argument against |
Hmm. That's a pretty compelling argument. How would you feel about |
|
yeah I'm happy with that. I'm also happy with keeping |
Mild preference for keeping |
| if source_normalized == debug_normalized { | ||
| eprintln!("let {} = {};", name, source); | ||
| } else { | ||
| eprintln!("let {} = {}; // = {}", name, source, debug); |
There was a problem hiding this comment.
I think a corresponding update to the output so that the format is a syntactically valid explicit test case could also be useful.
e.g. instead of Draw 1: 20828340, output #[hegel::explicit_test_case(x = 20828340).
We'd have to change the actual printer record_named_draw in TestCase (which I cannot comment on since it is unchanged in this PR).
Depends on #143. Review that one first.
This mirrors Hypothesis's example decorator. It lets you explicitly
provide a test case as a set of inputs to your test function.
Here's it in action. Consider the following:
If you run this you will see:
It will not work in all cases. Currently in some of those cases it will likely produce very bad error messages. I've tried to do my best to think of the common cases for this and provide good error messages there, ideally at compile time, but there are 100% going to be some missing ones that we can improve over time.