summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2022-01-10 17:14:01 -0500
committerLouis Dionne <ldionne.2@gmail.com>2022-01-11 10:34:59 -0500
commit7c7d59a35d65fecc5ed59f86f1c93163d2bd5365 (patch)
tree60aa151253cef7da70eed9b4063f85ac44433da4
parenta3b9edf8b8c3815c1a2c200f9bc00882e1244827 (diff)
downloadllvm-7c7d59a35d65fecc5ed59f86f1c93163d2bd5365.tar.gz
[libc++] Use TEST_HAS_NO_UNICODE instead of _LIBCPP_HAS_NO_UNICODE in the test suite
Differential Revision: https://reviews.llvm.org/D116973
-rw-r--r--libcxx/test/std/utilities/format/format.functions/format_tests.h8
-rw-r--r--libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp8
-rw-r--r--libcxx/test/support/msvc_stdlib_force_include.h4
-rw-r--r--libcxx/test/support/test_macros.h6
4 files changed, 14 insertions, 12 deletions
diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h
index 3de307ba6a44..f5a888eb35bf 100644
--- a/libcxx/test/std/utilities/format/format.functions/format_tests.h
+++ b/libcxx/test/std/utilities/format/format.functions/format_tests.h
@@ -11,6 +11,7 @@
#include <format>
#include "make_string.h"
+#include "test_macros.h"
// In this file the following template types are used:
// TestFunction must be callable as check(expected-result, string-to-format, args-to-format...)
@@ -227,7 +228,8 @@ void format_test_string(T world, T universe, TestFunction check,
template <class CharT, class TestFunction>
void format_test_string_unicode(TestFunction check) {
-#ifndef _LIBCPP_HAS_NO_UNICODE
+ (void)check;
+#ifndef TEST_HAS_NO_UNICODE
// ß requires one column
check(STR("aßc"), STR("{}"), STR("aßc"));
@@ -259,9 +261,7 @@ void format_test_string_unicode(TestFunction check) {
check(STR("a\u1110c---"), STR("{:-<7}"), STR("a\u1110c"));
check(STR("-a\u1110c--"), STR("{:-^7}"), STR("a\u1110c"));
check(STR("---a\u1110c"), STR("{:->7}"), STR("a\u1110c"));
-#else
- (void)check;
-#endif
+#endif // TEST_HAS_NO_UNICODE
}
template <class CharT, class TestFunction, class ExceptionTest>
diff --git a/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp b/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp
index ada7f09f0fd3..7fe6907f2f4b 100644
--- a/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp
@@ -227,7 +227,7 @@ void test(std::basic_string<CharT> expected, std::locale loc,
}
}
-#ifndef _LIBCPP_HAS_NO_UNICODE
+#ifndef TEST_HAS_NO_UNICODE
template <class CharT>
struct numpunct_unicode;
@@ -244,7 +244,7 @@ struct numpunct_unicode<wchar_t> : std::numpunct<wchar_t> {
string_type do_falsename() const override { return L"ungültig"; }
};
#endif
-#endif // _LIBCPP_HAS_NO_UNICODE
+#endif // TEST_HAS_NO_UNICODE
template <class CharT>
void test_bool() {
@@ -265,7 +265,7 @@ void test_bool() {
test(STR("true"), std::locale(LOCALE_en_US_UTF_8), STR("{:L}"), true);
test(STR("false"), std::locale(LOCALE_en_US_UTF_8), STR("{:L}"), false);
-#ifndef _LIBCPP_HAS_NO_UNICODE
+#ifndef TEST_HAS_NO_UNICODE
std::locale loc_unicode =
std::locale(std::locale(), new numpunct_unicode<CharT>());
@@ -276,7 +276,7 @@ void test_bool() {
test(STR("gültig!!!"), loc_unicode, STR("{:!<9L}"), true);
test(STR("_gültig__"), loc_unicode, STR("{:_^9L}"), true);
test(STR(" gültig"), loc_unicode, STR("{:>9L}"), true);
-#endif
+#endif // TEST_HAS_NO_UNICODE
}
template <class CharT>
diff --git a/libcxx/test/support/msvc_stdlib_force_include.h b/libcxx/test/support/msvc_stdlib_force_include.h
index b1ce02650a5d..bd83bee22ce7 100644
--- a/libcxx/test/support/msvc_stdlib_force_include.h
+++ b/libcxx/test/support/msvc_stdlib_force_include.h
@@ -104,8 +104,4 @@ const AssertionDialogAvoider assertion_dialog_avoider{};
__pragma(warning(pop))
#endif // __clang__
-#if defined(_MSVC_EXECUTION_CHARACTER_SET) && _MSVC_EXECUTION_CHARACTER_SET != 65001
-#define _LIBCPP_HAS_NO_UNICODE 1
-#endif
-
#endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_H
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index 322601609bf5..cde783a41db7 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -361,6 +361,12 @@ inline void DoNotOptimize(Tp const& value) {
# define TEST_HAS_NO_WIDE_CHARACTERS
#endif
+#if defined(_LIBCPP_HAS_NO_UNICODE)
+# define TEST_HAS_NO_UNICODE
+#elif defined(_MSVC_EXECUTION_CHARACTER_SET) && _MSVC_EXECUTION_CHARACTER_SET != 65001
+# define TEST_HAS_NO_UNICODE
+#endif
+
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif