From 99477fa9f1e89a7d8253c8aeee331864710d080c Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 24 May 2018 10:33:14 -0700 Subject: - 31d03284ca8017ba59d98d47e7d041f361d478a7 Release escaping microbenchmarks. by Alex Strelnikov - f183ce453db49ebc1948bb1d8eced37021cf63f7 Internal change. by Derek Mauro - b1660cb93e0fa37cdcecf37642766f5bfd12c7b0 Improve compatibility of some cc_test targets for portabl... by Abseil Team GitOrigin-RevId: 31d03284ca8017ba59d98d47e7d041f361d478a7 Change-Id: I9c4c4d2ad12cfe10c914f7cfa9aaab67fcef5cb1 --- absl/strings/ascii_test.cc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'absl/strings/ascii_test.cc') 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) { -- cgit v1.2.3