test(globalization): CultureInfo-invariance matrix over Try surface (#182) - #268
Merged
Conversation
Closes #182. Adds `GlobalizationInvarianceTests` (net6+) re-running a representative slice of the Try / Result surface under every hostile culture the fleet standard covers: en-US (baseline), tr-TR (dotted-I), de-DE (decimal-comma), zh-CN (collation), ar-SA (RTL + Hindi-Arabic digits), ja-JP (full-width digits). Each test swaps BOTH `CurrentCulture` and `CurrentUICulture`, executes the body, and restores in `finally` — a xunit parallelism split cannot leak culture across unrelated tests. Covered: - Result.Success / Result.Failure identity + ErrorMessage - Try.Run(Action) carries exception message verbatim - Try.Run<T>(Func<T>) returns value unchanged - Try.RunAsync succeeds under hostile culture - Result.AllSucceeded / AnyFailed / Flatten identical output Culture-sensitivity allowlist: EMPTY per top-of-file comment. If a future method introduces culture-dependent behaviour, it must be added there before merging and either excluded from the theory or explicitly asserted against invariant output. Local run: `dotnet test -f net10.0 --filter Globalization` → 30/30 pass (5 tests × 6 cultures) in 89 ms. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced Jul 28, 2026
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.
Closes #182.
Summary
Adds
GlobalizationInvarianceTests(net6+): 5 representative tests over the Try / Result surface, each run as a[Theory]with 6CultureInforows — en-US, tr-TR, de-DE, zh-CN, ar-SA, ja-JP. Per test: swapCurrentCulture+CurrentUICulture, run body, restore infinally.Allowlist
Empty. Try-Pattern doesn't format numbers/dates/collate/case-fold; its surface is culture-invariant by contract. Top-of-file comment documents this and requires new culture-sensitive methods to be added to the allowlist before merging.
Stacked-PR base
Base =
vNext. Fifth of the 11-PR batch.Local run
dotnet test -c Release -f net10.0 --filter FullyQualifiedName~Globalization→ 30/30 pass (5 × 6) in 89 ms.Test plan