Skip to content

Commit 47afa10

Browse files
authored
[libc++][z/OS] Disable portion of formatter.char.funsigned-char.pass.cpp for no unicode (#94044)
This PR carves out small portion of the test in subject to avoid the following failure when unicode is not available. ``` # | Assertion failure: result == expected .../formatter.char.funsigned-char.pass.cpp 56 # | # | Format string ?} # | Expected output '\x{80}' # | Actual output '�' ``` This was traced down to different definition of `__code_point_view::__consume()` under macro_LIBCXX_HAS_NO_UNICODE which is called inside `__formatter::__escape()`. The `__consume()` returns `__ok` and code assumes that escaped sequence was already written but it is not., thus the failure. Here is the snippen code we fall into: ``` typename __unicode::__consume_result __result = __view.__consume(); if (__result.__status == __unicode::__consume_result::__ok) { __escape = __formatter::__is_escaped_sequence_written(__str, __result.__code_point, __escape, __mark); ```
1 parent 04c4cf4 commit 47afa10

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.funsigned-char.pass.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,18 @@ void test() {
7171
#if TEST_STD_VER > 20
7272
test(STR(R"('\u{0}')"), STR("?}"), '\x00');
7373
test(STR("'a'"), STR("?}"), 'a');
74+
# ifndef TEST_HAS_NO_UNICODE
7475
if constexpr (std::same_as<CharT, char>) {
7576
test(STR(R"('\x{80}')"), STR("?}"), '\x80');
7677
test(STR(R"('\x{ff}')"), STR("?}"), '\xff');
7778
}
78-
# ifndef TEST_HAS_NO_WIDE_CHARACTERS
79+
# ifndef TEST_HAS_NO_WIDE_CHARACTERS
7980
else {
8081
test(STR(R"('\u{80}')"), STR("?}"), '\x80');
8182
test(STR("'\u00ff'"), STR("?}"), '\xff');
8283
}
83-
# endif // TEST_HAS_NO_WIDE_CHARACTERS
84+
# endif // TEST_HAS_NO_WIDE_CHARACTERS
85+
# endif // TEST_HAS_NO_UNICODE
8486
#endif // TEST_STD_VER > 20
8587

8688
test(STR("10000000"), STR("b}"), char(128));

0 commit comments

Comments
 (0)