Skip to content

ContributionMilestoneTests fails locally on non-US locales (31.000 vs 31,000) #435

Description

@esteugene

What happens

ContributionMilestoneTests → "share message and URLs include encoded milestone content" fails on
any machine whose locale groups thousands with . rather than ,:

Expectation failed: (message → "I've dictated 31.000 words with Muesli. …") == "I've dictated 31,000 words with Muesli. …"
Expectation failed: (tweetURL.absoluteString → "…31.000%20words…").contains("31,000")

The test asserts a US-grouped 31,000, but the value is formatted with the current locale, so on a
German, Swiss, Polish, Russian, Dutch (and so on) system it renders 31.000 and the two assertions
fail. CI runs on a US locale, so the suite is green there and only contributors see it.

Reproduce

defaults write -g AppleLocale -string "de_CH"   # or run on a machine already set to such a locale
swift test --package-path native/MuesliNative --filter ContributionMilestone

Observed on main at c0a73d7, macOS 27, locale pl_PL with de_CH regional formats:
Test run with 11 tests in 1 suite failed with 2 issues.

Suggested fix

Either format the expectation with the same locale-aware formatter the production code uses, or pin
the formatter in the test to a fixed locale (Locale(identifier: "en_US_POSIX")) so the assertion
does not depend on the developer's region.

I noticed this while running the suite for #433 / #434 and confirmed it fails identically on
unmodified main, so it is not caused by those branches. Happy to send a patch if you have a
preference between the two approaches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions