diff options
| author | Joseph Huber <huberjn@outlook.com> | 2024-08-22 12:41:20 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-22 12:41:20 -0500 |
| commit | 8f005f8306dc52577b3b9482d271fb463f0152a5 (patch) | |
| tree | b40e9c850a1f06146d88ee7f041cf40c2c3013b3 /libc/test/src/locale/locale_test.cpp | |
| parent | e31322ba59071b4aa288c9d956f4c9d1ee10b080 (diff) | |
[libc] Add `ctype.h` locale variants (#102711)
Summary:
This patch adds all the libc ctype variants. These ignore the locale
ingormation completely, so they're pretty much just stubs. Because these
use locale information, which is system scope, we do not enable building
them outisde of full build mode.
Diffstat (limited to 'libc/test/src/locale/locale_test.cpp')
| -rw-r--r-- | libc/test/src/locale/locale_test.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libc/test/src/locale/locale_test.cpp b/libc/test/src/locale/locale_test.cpp new file mode 100644 index 000000000000..bc48bb851f4e --- /dev/null +++ b/libc/test/src/locale/locale_test.cpp @@ -0,0 +1,27 @@ +//===-- Unittests for locale ----------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/locale/freelocale.h" +#include "src/locale/newlocale.h" +#include "src/locale/uselocale.h" + +#include "test/UnitTest/Test.h" + +#include "include/llvm-libc-macros/locale-macros.h" + +TEST(LlvmLibcLocale, DefaultLocale) { + locale_t new_locale = LIBC_NAMESPACE::newlocale(LC_ALL, "C", nullptr); + EXPECT_NE(new_locale, static_cast<locale_t>(nullptr)); + + locale_t old_locale = LIBC_NAMESPACE::uselocale(new_locale); + EXPECT_NE(old_locale, static_cast<locale_t>(nullptr)); + + LIBC_NAMESPACE::freelocale(new_locale); + + LIBC_NAMESPACE::uselocale(old_locale); +} |
