Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OrderedImports] Fix dropped trailing comments on top-level code items. #674

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

allevato
Copy link
Member

Also add some validation logic in format rule tests. We already run the pretty printer afterwards to verify that there aren't any invariants broken that would cause an assertion failure, but we don't compare the actual pretty-printed text to the originally transformed tree (because we don't want the output of those tests to be sensitive to pretty-printer configuration). What we can do, which is still an improvement, is walk the token sequence and compare the tokens and trivia in a whitespace-insensitive manner. This makes sure that we don't move trivia around in a way that the format rule would accept but that the pretty-printer wouldn't know how to handle.

Also add some validation logic in format rule tests. We already run the
pretty printer afterwards to verify that there aren't any invariants
broken that would cause an assertion failure, but we don't compare the
actual pretty-printed text to the originally transformed tree (because
we don't want the output of those tests to be sensitive to
pretty-printer configuration). What we *can* do, which is still an
improvement, is walk the token sequence and compare the tokens and
trivia in a whitespace-insensitive manner. This makes sure that we
don't move trivia around in a way that the format rule would accept
but that the pretty-printer wouldn't know how to handle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant