test(uax14): stop tests from mutating generated source#12
Merged
Conversation
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.
TestProfilePairTableUsage regenerated rule_exception_pairs.go as a side effect of 'go test', writing it in non-deterministic map order and without the gofmt-required blank // separator before //go:inline — so every test run dirtied tracked, gofmt-clean source. This separates generation from testing so the default 'go test' path is side-effect-free; any retained regeneration is deterministic (sorted) and gofmt-clean.
The default TestProfilePairTableUsage is now observational only (profiles and logs, never writes). Regeneration moves to TestRegenerateRuleExceptionPairs, gated behind UAX14_REGEN=1 and skipped by default; its output is sorted by class and run through go/format (so the // separator and indentation are always correct). The generation logic stays in the test package (not a standalone //go:build ignore tool like the other generate_*.go) because it must drive the package-internal line-break engine, which a separate package main cannot reach.
No change to line-breaking logic or rule-exception table semantics; rule_exception_pairs.go is untouched by this PR. Verified: after 'go test ./uax14/... -count=1', git status shows no modified tracked files (profiler ran over 19,338 cases / 1386 rule-only pairs), gofmt -l uax14/ is empty, go vet clean.