Skip to content

test(uax14): stop tests from mutating generated source#12

Merged
SCKelemen merged 1 commit into
mainfrom
SCKelemen/uax14-profiler-no-mutate
Jun 12, 2026
Merged

test(uax14): stop tests from mutating generated source#12
SCKelemen merged 1 commit into
mainfrom
SCKelemen/uax14-profiler-no-mutate

Conversation

@SCKelemen

Copy link
Copy Markdown
Owner

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.

@SCKelemen
SCKelemen merged commit 8d6a0ad into main Jun 12, 2026
5 checks passed
@SCKelemen
SCKelemen deleted the SCKelemen/uax14-profiler-no-mutate branch June 12, 2026 11:27
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