Use Debug.toText instead of Debug.trace in test.randomWithSeed
ceedubs opened this issue · comments
Cody Allen commented
test.randomWithSeed
(and its dependent test.random
) used Debug.trace
when a Failure
was raised during a test. There were several things that were awkward about this:
- Because of the test cache, you would only see the failure the first time that the test failed (unless you ran
debug.clear-cache
). - The test summary would simply say
🚫 FAILED Failed
instead of a more helpful message. - Since
Debug.trace
prints to stdout, the output doesn't show up in transcript output files (at least as of now).
Now that Debug.toText
exists, if a test fails with Failure f
we can simply fail with the message Debug.toText f
and all of these problems go away!
◉ Universal.max.tests.partialOrder : Passed 100 tests.
◉ Universal.min.tests.absorption : Passed 100 tests.
✗ foo.thing Failure
(typeLink TestFailure)
"validation failed"
(Any '(1 Nat.== 2))
🚫 1 test(s) failing, ✅ 533 test(s) passing
Code review
Note: I don't know why this doesn't show any not-auto-propagated updates, since I definitely edited test.randomWithSeed
.
The changes summarized below are available for you to review, using the following command:
pull-request.load unison.public.base.main ceedubs.public.pr.base.test_no_trace
Updates:
There were 91 auto-propagated updates.
patch patch (added 1 updates)
Rúnar commented
This is merged into main. 🌈⭐