summaryrefslogtreecommitdiffstats
path: root/tests/locale_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/locale_test.cpp')
-rw-r--r--tests/locale_test.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/locale_test.cpp b/tests/locale_test.cpp
index 7ec607a..f308af5 100644
--- a/tests/locale_test.cpp
+++ b/tests/locale_test.cpp
@@ -71,20 +71,30 @@ TEST(locale, setlocale) {
EXPECT_EQ(ENOENT, errno); // POSIX specified, not an implementation detail!
}
-TEST(locale, newlocale) {
+TEST(locale, newlocale_invalid_category_mask) {
errno = 0;
EXPECT_EQ(0, newlocale(1 << 20, "C", 0));
EXPECT_EQ(EINVAL, errno);
+}
- locale_t l = newlocale(LC_ALL, "C", 0);
- ASSERT_TRUE(l != NULL);
- freelocale(l);
+TEST(locale, newlocale_NULL_locale_name) {
+ errno = 0;
+ EXPECT_EQ(0, newlocale(LC_ALL, NULL, 0));
+ EXPECT_EQ(EINVAL, errno);
+}
+TEST(locale, newlocale_bad_locale_name) {
errno = 0;
EXPECT_EQ(0, newlocale(LC_ALL, "this-is-not-a-locale", 0));
EXPECT_EQ(ENOENT, errno); // POSIX specified, not an implementation detail!
}
+TEST(locale, newlocale) {
+ locale_t l = newlocale(LC_ALL, "C", 0);
+ ASSERT_TRUE(l != NULL);
+ freelocale(l);
+}
+
TEST(locale, duplocale) {
locale_t cloned_global = duplocale(LC_GLOBAL_LOCALE);
ASSERT_TRUE(cloned_global != NULL);