C# test OutputThatDoesNotParseFails fails under non-English locales
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 79/100
Research direction
Read rewrite-csharp/csharp/OpenRewrite.Tests/Core/ParserShapedTreesTests.cs around lines 88–89 and run the filtered OutputThatDoesNotParseFails test with DOTNET_CLI_UI_LANGUAGE set to ko-KR or ja-JP. Check how the assertion can verify the diagnostic code and invalid source without relying on localized message text. Done means the test passes across the listed locales while still checking the parsing failure.
Written by the indexing model from the issue text.
Description
Description
The C# test ParserShapedTreesTests.OutputThatDoesNotParseFails passes with DOTNET_CLI_UI_LANGUAGE=en-US, but fails with ko-KR and ja-JP.
The test appears to be locale-dependent because it expects a hardcoded English Roslyn diagnostic message:
ParserShapedTreesTests.cs:88–89
Assert.Contains(
"\n the text it prints doesn't parse: CS1002 ; expected at `return null null;`\n",
failure.Message);
For example, the Korean diagnostic uses CS1002 ;이 필요합니다. instead of CS1002 ; expected.
Steps to reproduce
Run the following command from the repository root, changing the locale between en-US, ko-KR, and ja-JP:
DOTNET_CLI_UI_LANGUAGE=ko-KR \
dotnet test rewrite-csharp/csharp/OpenRewrite.Tests/OpenRewrite.Tests.csproj \
--filter "FullyQualifiedName~OutputThatDoesNotParseFails"
| Locale | Result |
|---|---|
en-US |
PASS |
ko-KR |
FAIL |
ja-JP |
FAIL |
The failure occurs at ParserShapedTreesTests.cs:88 with Assert.Contains() Failure: Sub-string not found.
Possible solutions
Depending on the intended purpose of the test:
- Locale-independent assertion: If the test is intended to verify a parsing failure, check the diagnostic code (
CS1002) and invalid source (return null null;) separately, without depending on localized diagnostic text. - Explicit English locale: If the full diagnostic message must be verified, explicitly control the diagnostic culture in the test or document
DOTNET_CLI_UI_LANGUAGE=en-USas a workaround for contributors.
Environment
- macOS ARM64
- .NET SDK 10.0.404
- Commit:
a848f9928ea8487d0017616cbc0b960ece63bdc3
- Dominant language
- Java
- Stars
- 3.9k
- Forks
- 599
- Avg merge
- 9h 38m
- Merged PRs (30d)
- 557
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openrewrite/rewrite
-
bug gradle
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
openrewrite/rewrite#7576 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
openrewrite/rewrite#9834 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
openrewrite/rewrite#9819 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 55/100
openrewrite/rewrite#9817 ·
Maintainers usually reply within 1 day
-
Recipes should avoid comparisons on String representation of LSTs (`.toString()`)Possibly taken @greg-at-moderne claimed this 1 day ago. Open
openrewrite/rewrite#9797 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in openrewrite/rewrite
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
aws/aws-emulator#30 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 4 days
-
Bug: Minor Status: Triage
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
GTNewHorizons/GT-New-Horizons-Modpack#27664 · 1 comment ·
Maintainers usually reply within 1 day
-
serviceability
Difficulty 1/5 Under an hour Newbie friendliness 65/100
OpenLiberty/open-liberty#36348 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Stirling-Tools/Stirling-PDF#8875 · 1 reaction ·
Maintainers usually reply within 2 days