Repository navigation
ppx_devtools.expect: fix tests in functors and attributes on sequences - #8
Merged
Merged
Conversation
- A test in a functor applied more than once is registered once per
application, and each registration gave the same corrections: promotion
wrote [%expect {| a |} {| a |}], and inserted a new [%expect] twice.
Identical corrections are now applied once.
- The attributes of a sequence in a test body were dropped when the
sequence was rebuilt, e.g. the [@warning "-21"] of
[(raise Exit; ...) [@warning "-21"]]. They are now kept, and a nested
sequence carrying attributes is left as a statement of its own.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two bugs found while looking for bugs in the expect ppx and its runtime.
A test in a functor applied more than once
Such a test is registered once per application, and each registration produced the same corrections, all of which were applied. Promotion wrote
which does not compile, and inserted a new trailing
[%expect]twice. Identical corrections for a file are now applied once.Not covered: when the instances print different outputs, the correction of one of them is still silently dropped.
Attributes on a sequence
A sequence in a test body is rebuilt by the ppx, which dropped its attributes:
(raise Exit; ...) [@warning "-21"]lost its[@warning]. They are now kept. A nested sequence carrying attributes, as ina; ((b; c) [@attr]), is no longer flattened into the enclosing one, so an[%expect]in it is not grouped with[@when]variants outside of it.Tests
Two cases added to
test/promote: a functor applied twice, and a sequence that does not compile without its[@warning "-21"]. Native tests pass; the js and wasm aliases were not run locally.🤖 Generated with Claude Code