[libcxx-commits] [libcxx] [libcxx][test][AIX] address more platform differences in locale tests (PR #94826)

David Tenty via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 10 08:00:16 PDT 2024


================
@@ -204,17 +209,20 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative, showbase
-            std::string v = currency_symbol + "-1,234,567.89";
-            std::showbase(ios);
-            typedef cpp17_input_iterator<const char*> I;
-            long double ex;
-            std::ios_base::iostate err = std::ios_base::goodbit;
-            I iter = f.get(I(v.data()), I(v.data() + v.size()),
-                                                false, ios, err, ex);
-            assert(base(iter) == v.data() + v.size());
-            assert(err == std::ios_base::eofbit);
-            assert(ex == -123456789);
-            std::noshowbase(ios);
+#ifdef _AIX
+          std::string v = "-" + currency_symbol + "1,234,567.89";
----------------
daltenty wrote:

I wouldn't necessarily disagree with you (though I'm still trying to grok the exact limits placed on the locale definition by the various standards involved). I'll note though what we are doing here is consistent with other platforms with similar locale quirks/bugs are doing in the tests. 

IMHO it be nice to keep a consistent approach across tests and platforms here, which I think means doing some variation of either:

1. Platforms are allow to handle or encode their locale quirks in the tests
2. The tests only handle standard/ideal locale definitions (i.e. according to something like the [Unicode CLDR](https://cldr.unicode.org/)) and platforms need to opt-out of the tests till such a time as they fix their quirks

Currently, this PR and the existing platforms / locale tests seem to follow approach 1. I wouldn't mind a move to approach 2, but I think that's a change in the status quo.


https://github.com/llvm/llvm-project/pull/94826


More information about the libcxx-commits mailing list