Collapse PhoneNumberUtilTest ports into one file mirroring Java order#261
Merged
Merged
Conversation
Merge the topically-split phonenumberutil_*_test.go ports back into a single phonenumberutil_test.go whose test functions are ordered to match upstream's PhoneNumberUtilTest.java method-by-method, so the file can be diffed straight against upstream when reconciling. The split was only ever justified as a staging area while the ad-hoc real-metadata tests were migrated to faithful synthetic-metadata ports; that migration is effectively complete, so the split now adds drift risk (which file does a new upstream test belong in?) without benefit. Also rename the former ad-hoc test file to phonenumberutil_internal_test.go and rewrite its header: what remains has no upstream PhoneNumberUtilTest counterpart (direct tests of internal helpers and the RegexCache strictness behaviour), so the "migration in progress / shrink to nothing" framing was stale. No test logic changes: the merged file contains exactly the same 120 test functions as the 11 files it replaces (verified by set diff), and the full suite passes.
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.
What
Merge the topically-split
phonenumberutil_*_test.gofiles (_format_,_format_dialing_,_format_natprefix_,_format_outofcountry_,_parse_basic_,_parse_extensions_,_types_,_possibility_,_normalize_,_isnumbermatch_) back into a singlephonenumberutil_test.go, with the test functions ordered to mirror upstream'sPhoneNumberUtilTest.javamethod-by-method.Also rename the former ad-hoc test file
phonenumberutil_adhoc_test.go→phonenumberutil_internal_test.goand rewrite its header.Why
This package tracks libphonenumber's Java reference implementation, and the stated goal of these test files (per
SYNC.mdand every file header) is to stay diffable against upstream so syncs are mechanical.PhoneNumberUtilTestcounterpart has been ported out.PhoneNumberUtilTest.java.phonenumberutil_internal_test.goholds what genuinely has no upstreamPhoneNumberUtilTestcounterpart: direct unit tests of internal helpers (normalizeDigits,setItalianLeadingZerosForPhoneNumber,maybeStripExtension,mergeLengths,formattingRuleHasFirstGroupOnly) and the RegexCache strictness behaviour. Its old header described a migration that's done, so it was stale/misleading.Notes for reviewers
TestFormatByPatternFGProdMetadata,TestFormatNationalPrefixFormattingRule) are placed next toTestFormatByPattern.adhoc → internalrename is detected by git as a rename (header-only edit).gofmt/go vetclean.