This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Fix en_US money locale formatting tests on Windows
ClosedPublic

Authored by mstorsjo on Mar 2 2022, 1:23 AM.

Details

Summary

In the en_US locale on Windows, negative currency amounts is formatted
as "($0.01)" instead of "-$0.01".

Adjust the test references accordingly, making these tests pass.

This is more of the same as in D120549.

Diff Detail

Event Timeline

mstorsjo created this revision.Mar 2 2022, 1:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2022, 1:23 AM
mstorsjo requested review of this revision.Mar 2 2022, 1:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2022, 1:23 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
mstorsjo updated this revision to Diff 412370.Mar 2 2022, 3:33 AM

Fix a couple missed differences in the put_money test.

Looks reasonable to me. I do still wonder if it would be profitable to introduce a macro throughout instead of repeating the less-greppable #ifdef _WIN32; something like

ASSERT_ON_WIN32(ex == L"   (USD1,234,567.89)");
ASSERT_EXCEPT_WIN32(ex == L"   -USD 1,234,567.89");

or even something like

ASSERT_EQ_WIN32(ex, L"   -USD 1,234,567.89", L"   (USD1,234,567.89)");

(although that's a terrible name and I can't think of a good one).

ldionne accepted this revision.Mar 2 2022, 12:55 PM
This revision is now accepted and ready to land.Mar 2 2022, 12:55 PM