This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Fix moneypunct grouping tests on Windows
ClosedPublic

Authored by mstorsjo on Feb 17 2022, 2:28 PM.

Details

Summary

For grouping strings, "\3" and "\3\3" are equivalent.

Diff Detail

Event Timeline

mstorsjo requested review of this revision.Feb 17 2022, 2:28 PM
mstorsjo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2022, 2:28 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp
93

https://en.cppreference.com/w/cpp/locale/numpunct/grouping
Geesh, this stuff is ridiculous. I buy how \3 and \3\3 are equivalent; but then my next question is, why does the existing code (on non-Windows) return \3\3? Is that due to something at the OS level that's out of our control, or is there some way that libc++ could fix it to sanely return a simple \3 like cppreference says it should?

mstorsjo added inline comments.Feb 17 2022, 9:21 PM
libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp
93

Like most of these things, I guess it’s pretty much passthrough from the OS’s locale data. I guess we could fix it up within the library, but I’m not sure if it’s worth it, if they’re both functionally equivalent anyway.

Mordante accepted this revision as: Mordante.Feb 21 2022, 11:07 AM

LGTM!

libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp
93

Looking at my Linux system
en_US mon_grouping 3;3
fr_FR mon_grouping 3

So these values have this value in the system's locale.
I don't think libc++ should try to fix this, better to fix the system's locale instead.

Quuxplusone accepted this revision.Feb 21 2022, 11:14 AM
This revision is now accepted and ready to land.Feb 21 2022, 11:14 AM
This revision was landed with ongoing or failed builds.Feb 21 2022, 1:09 PM
This revision was automatically updated to reflect the committed changes.