#ifdefined(__BIONIC__) // The "" locale is implementation-defined. For bionic, it's the C.UTF-8 locale, which is // pretty much all we support anyway. // glibc will give us something like "en_US.UTF-8", depending on the user's configuration.
EXPECT_STREQ("C.UTF-8", setlocale(LC_ALL, "")); #endif
EXPECT_STREQ("C", setlocale(LC_ALL, "C"));
EXPECT_STREQ("C", setlocale(LC_ALL, "POSIX"));
// ENOENT is specified by POSIX, not an implementation detail!
EXPECT_ERRNO_FAILURE(ENOENT, nullptr, setlocale(LC_ALL, "this-is-not-a-locale"));
}
TEST(locale, newlocale_bad_locale_name) { // ENOENT is specified by POSIX, not an implementation detail!
EXPECT_ERRNO_FAILURE(ENOENT, nullptr, newlocale(LC_ALL, "this-is-not-a-locale", nullptr));
}
locale_t old = uselocale(n);
EXPECT_TRUE(old == original);
EXPECT_EQ(n, uselocale(nullptr));
}
TEST(locale, mb_cur_max) { // We can't reliably test the behavior with setlocale(3) or the behavior for // initial program conditions because (unless we're the only test that was // run), another test has almost certainly called uselocale(3) in this thread. // See b/16685652.
locale_t cloc = newlocale(LC_ALL, "C", nullptr);
locale_t cloc_utf8 = newlocale(LC_ALL, "C.UTF-8", nullptr);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.