diff options
author | Abseil Team <absl-team@google.com> | 2018-05-24 10:33:14 -0700 |
---|---|---|
committer | katzdm <katzdm@google.com> | 2018-05-24 13:59:23 -0400 |
commit | 99477fa9f1e89a7d8253c8aeee331864710d080c (patch) | |
tree | 8c879314e11c9ff696b9a69c6411042c04b886f7 /absl/strings/ascii_test.cc | |
parent | 014f02a3eca93ef88163c3b408c86998ecf6572c (diff) |
- 31d03284ca8017ba59d98d47e7d041f361d478a7 Release escaping microbenchmarks. by Alex Strelnikov <strel@google.com>
- f183ce453db49ebc1948bb1d8eced37021cf63f7 Internal change. by Derek Mauro <dmauro@google.com>
- b1660cb93e0fa37cdcecf37642766f5bfd12c7b0 Improve compatibility of some cc_test targets for portabl... by Abseil Team <absl-team@google.com>
GitOrigin-RevId: 31d03284ca8017ba59d98d47e7d041f361d478a7
Change-Id: I9c4c4d2ad12cfe10c914f7cfa9aaab67fcef5cb1
Diffstat (limited to 'absl/strings/ascii_test.cc')
-rw-r--r-- | absl/strings/ascii_test.cc | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/absl/strings/ascii_test.cc b/absl/strings/ascii_test.cc index 97f36013..9903b049 100644 --- a/absl/strings/ascii_test.cc +++ b/absl/strings/ascii_test.cc @@ -130,9 +130,11 @@ TEST(AsciiIsFoo, All) { // Checks that absl::ascii_isfoo returns the same value as isfoo in the C // locale. TEST(AsciiIsFoo, SameAsIsFoo) { +#ifndef __ANDROID__ // temporarily change locale to C. It should already be C, but just for safety - std::string old_locale = setlocale(LC_CTYPE, nullptr); - ASSERT_TRUE(setlocale(LC_CTYPE, "C")); + const char* old_locale = setlocale(LC_CTYPE, "C"); + ASSERT_TRUE(old_locale != nullptr); +#endif for (int i = 0; i < 256; i++) { EXPECT_EQ(isalpha(i) != 0, absl::ascii_isalpha(i)) << i; @@ -150,14 +152,18 @@ TEST(AsciiIsFoo, SameAsIsFoo) { EXPECT_EQ(isascii(i) != 0, absl::ascii_isascii(i)) << i; } +#ifndef __ANDROID__ // restore the old locale. - ASSERT_TRUE(setlocale(LC_CTYPE, old_locale.c_str())); + ASSERT_TRUE(setlocale(LC_CTYPE, old_locale)); +#endif } TEST(AsciiToFoo, All) { +#ifndef __ANDROID__ // temporarily change locale to C. It should already be C, but just for safety - std::string old_locale = setlocale(LC_CTYPE, nullptr); - ASSERT_TRUE(setlocale(LC_CTYPE, "C")); + const char* old_locale = setlocale(LC_CTYPE, "C"); + ASSERT_TRUE(old_locale != nullptr); +#endif for (int i = 0; i < 256; i++) { if (absl::ascii_islower(i)) @@ -180,9 +186,10 @@ TEST(AsciiToFoo, All) { EXPECT_EQ(absl::ascii_tolower(i), absl::ascii_tolower(sc)) << i; EXPECT_EQ(absl::ascii_toupper(i), absl::ascii_toupper(sc)) << i; } - +#ifndef __ANDROID__ // restore the old locale. - ASSERT_TRUE(setlocale(LC_CTYPE, old_locale.c_str())); + ASSERT_TRUE(setlocale(LC_CTYPE, old_locale)); +#endif } TEST(AsciiStrTo, Lower) { |