[all-commits] [llvm/llvm-project] f1d0d6: [libcxx] [test] Fix the monetary locale pos/neg_fo...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Sun Feb 27 12:08:40 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f1d0d6f70c63a465c102742c7b910cc201a9502e
      https://github.com/llvm/llvm-project/commit/f1d0d6f70c63a465c102742c7b910cc201a9502e
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-02-27 (Sun, 27 Feb 2022)

  Changed paths:
    M libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp
    M libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp

  Log Message:
  -----------
  [libcxx] [test] Fix the monetary locale pos/neg_format test for Windows and macOS

The zh_CN.UTF-8 locale on Glibc has got `n_sign_posn == 4` (which means
having the negative sign just after the currency symbol), but has
`int_n_sign_posn == 1` (which means before the string).

On Windows, there's no separate `int_n_sign_posn` field, so the same
`n_sign_posn` (which is 4 there too) is used for international currency
formatting too. This makes the ordering for the international case on
Windows be the same as for the national one right above it.

On Apple platforms, the fr_FR.UTF-8 locale has got `n_sign_posn == 2`
but `p_sign_posn == 1`, giving a different order for the French locale
for the negative format.

On Apple platforms for the zh_CN.UTF-8 locale, both `n_sign_posn` and
`int_n_sign_posn` are 4, but `p_sign_posn` and `int_p_sign_posn` are 1.

Differential Revision: https://reviews.llvm.org/D120550


  Commit: acf20001a01119ce02d5f2b0282e5a7c966ca12c
      https://github.com/llvm/llvm-project/commit/acf20001a01119ce02d5f2b0282e5a7c966ca12c
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-02-27 (Sun, 27 Feb 2022)

  Changed paths:
    M libcxx/test/libcxx/selftest/dsl/dsl.sh.py

  Log Message:
  -----------
  [libcxx] [test] Fix one failing part of dsl.sh.py on Windows.

Windows UCRT has got a bug in older versions (present in CI), where
it successfully does set a locale named
`for_sure_this_is_not_an_existing_locale`. By adjusting the tested
locale name to `forsurethisisnotanexistinglocale`, that test works
as expected, failing to set the locale.

The bug is reported upstream at
https://developercommunity.visualstudio.com/t/setlocale-succeeds-for-bogus-locale-names-in-older/1652241,
but as it already is working correctly in newer versions, no action
was prompted there.

We could of course add a bug detection in features.py like other
existing `broken-*` features, but that would seem kinda
pointless as it would be doing exactly what this test does.
Instead just adjust the tested dummy locale name.

This bit was approved to be committed on its own, in
https://reviews.llvm.org/D120546 (which is left open to follow up on
review of the rest of that patch).


Compare: https://github.com/llvm/llvm-project/compare/f6cb59d35f8c...acf20001a011


More information about the All-commits mailing list