mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
[PR #868] [MERGED] Make Test Report locale independent #779
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/868
Author: @StefMa
Created: 12/24/2024
Status: ✅ Merged
Merged: 1/2/2025
Merged by: @bioball
Base:
main← Head:fix-test-report📝 Commits (6)
cabd005Make SimpleReport locale independent2f61b5dTest for locale independenceb652fc8Merge branch 'apple:main' into fix-test-report33e756fAdd missing importf94d715Fix formatting77f1571Wrap test into try/finally📊 Changes
2 files changed (+50 additions, -1 deletions)
View changed files
📝
pkl-cli/src/test/kotlin/org/pkl/cli/CliTestRunnerTest.kt(+45 -0)📝
pkl-core/src/main/java/org/pkl/core/stdlib/test/report/SimpleReport.java(+5 -1)📄 Description
fixes #861
According to AI (and javadoc 😅) the problem is that String.format takes Locale.getDefault if not specified. Indeed I have set de-EN on my machine so it takes comma decimals instead of dot decimals.
I haven't tested this yet, just created it on mobile...This is my macobok setting (not sure if relevant or the correct screen):

If I run the newly added test without

Locale.ROOTinSimpleReport, I get the following error:Running with that
Locale.ROOT:BUILD SUCCESSFUL in 37s🎉AI summary
This pull request includes changes to improve locale independence in the
CliTestRunnerand to ensure consistent locale usage in theSimpleReportclass. The most important changes include adding a locale independence test forCliTestRunnerand specifying the root locale for formatting inSimpleReport.Locale independence improvements:
pkl-cli/src/test/kotlin/org/pkl/cli/CliTestRunnerTest.kt: Added a new testCliTestRunner locale independence testto verify thatCliTestRunnerworks correctly regardless of the default locale.pkl-core/src/main/java/org/pkl/core/stdlib/test/report/SimpleReport.java: Importedjava.util.Localeto use for specifying locale in formatting.pkl-core/src/main/java/org/pkl/core/stdlib/test/report/SimpleReport.java: Modified themakeStatsLinemethod to useLocale.ROOTinString.formatto ensure consistent formatting regardless of the default locale.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.