about summary refs log tree commit diff
path: root/absl/flags/internal/commandlineflag_test.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2020-05-07T17·42-0700
committervslashg <gfalcon@google.com>2020-05-07T19·26-0400
commita35ef8a62ce7cded2f131ccbd2b5c4a81d622507 (patch)
tree2b4a4451d714d8ebee30db71f7a0ee8430e9789e /absl/flags/internal/commandlineflag_test.cc
parentbd317cae3bc2630d1b12c5f1d77036e937d1d725 (diff)
Export of internal Abseil changes
--
034c30a00c64d93b9fcbc9d99a0a33801544d741 by Gennadiy Rozental <rogeeff@google.com>:

Split private handle interfaces accessor into a separate target with private visibility.

PiperOrigin-RevId: 310391488

--
6f6ca869309b17900b90849e08488ce7f7b0193a by Derek Mauro <dmauro@google.com>:

Remove __CLANG_SUPPORT_DYN_ANNOTATION__, which is a symbol defined by us
to be true in all builds

PiperOrigin-RevId: 310385325

--
ed5c1880c86973c000e826a3006b38e53ab3ed52 by Samuel Benzaquen <sbenza@google.com>:

Add tests to exercise extreme width and precision, and fix the overflows from
it.

PiperOrigin-RevId: 310224957
GitOrigin-RevId: 034c30a00c64d93b9fcbc9d99a0a33801544d741
Change-Id: I6c89a3c89ae92fa617c696044148ce9a79bcdda8
Diffstat (limited to 'absl/flags/internal/commandlineflag_test.cc')
-rw-r--r--absl/flags/internal/commandlineflag_test.cc31
1 files changed, 16 insertions, 15 deletions
diff --git a/absl/flags/internal/commandlineflag_test.cc b/absl/flags/internal/commandlineflag_test.cc
index 4aeb3bf4dd3c..54d50fff353d 100644
--- a/absl/flags/internal/commandlineflag_test.cc
+++ b/absl/flags/internal/commandlineflag_test.cc
@@ -20,6 +20,7 @@
 
 #include "gtest/gtest.h"
 #include "absl/flags/flag.h"
+#include "absl/flags/internal/private_handle_accessor.h"
 #include "absl/flags/internal/registry.h"
 #include "absl/flags/usage_config.h"
 #include "absl/memory/memory.h"
@@ -122,52 +123,52 @@ TEST_F(CommandLineFlagTest, TestParseFromCurrentValue) {
   auto* flag_01 = flags::FindCommandLineFlag("int_flag");
   EXPECT_FALSE(flag_01->IsSpecifiedOnCommandLine());
 
-  EXPECT_TRUE(flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(flags::PrivateHandleAccessor::ParseFrom(
       flag_01, "11", flags::SET_FLAGS_VALUE, flags::kProgrammaticChange, &err));
   EXPECT_EQ(absl::GetFlag(FLAGS_int_flag), 11);
   EXPECT_FALSE(flag_01->IsSpecifiedOnCommandLine());
 
-  EXPECT_TRUE(flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(flags::PrivateHandleAccessor::ParseFrom(
       flag_01, "-123", flags::SET_FLAGS_VALUE, flags::kProgrammaticChange,
       &err));
   EXPECT_EQ(absl::GetFlag(FLAGS_int_flag), -123);
   EXPECT_FALSE(flag_01->IsSpecifiedOnCommandLine());
 
-  EXPECT_TRUE(!flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(!flags::PrivateHandleAccessor::ParseFrom(
       flag_01, "xyz", flags::SET_FLAGS_VALUE, flags::kProgrammaticChange,
       &err));
   EXPECT_EQ(absl::GetFlag(FLAGS_int_flag), -123);
   EXPECT_EQ(err, "Illegal value 'xyz' specified for flag 'int_flag'");
   EXPECT_FALSE(flag_01->IsSpecifiedOnCommandLine());
 
-  EXPECT_TRUE(!flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(!flags::PrivateHandleAccessor::ParseFrom(
       flag_01, "A1", flags::SET_FLAGS_VALUE, flags::kProgrammaticChange, &err));
   EXPECT_EQ(absl::GetFlag(FLAGS_int_flag), -123);
   EXPECT_EQ(err, "Illegal value 'A1' specified for flag 'int_flag'");
   EXPECT_FALSE(flag_01->IsSpecifiedOnCommandLine());
 
-  EXPECT_TRUE(flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(flags::PrivateHandleAccessor::ParseFrom(
       flag_01, "0x10", flags::SET_FLAGS_VALUE, flags::kProgrammaticChange,
       &err));
   EXPECT_EQ(absl::GetFlag(FLAGS_int_flag), 16);
   EXPECT_FALSE(flag_01->IsSpecifiedOnCommandLine());
 
-  EXPECT_TRUE(flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(flags::PrivateHandleAccessor::ParseFrom(
       flag_01, "011", flags::SET_FLAGS_VALUE, flags::kCommandLine, &err));
   EXPECT_EQ(absl::GetFlag(FLAGS_int_flag), 11);
   EXPECT_TRUE(flag_01->IsSpecifiedOnCommandLine());
 
-  EXPECT_TRUE(!flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(!flags::PrivateHandleAccessor::ParseFrom(
       flag_01, "", flags::SET_FLAGS_VALUE, flags::kProgrammaticChange, &err));
   EXPECT_EQ(err, "Illegal value '' specified for flag 'int_flag'");
 
   auto* flag_02 = flags::FindCommandLineFlag("string_flag");
-  EXPECT_TRUE(flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(flags::PrivateHandleAccessor::ParseFrom(
       flag_02, "xyz", flags::SET_FLAGS_VALUE, flags::kProgrammaticChange,
       &err));
   EXPECT_EQ(absl::GetFlag(FLAGS_string_flag), "xyz");
 
-  EXPECT_TRUE(flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(flags::PrivateHandleAccessor::ParseFrom(
       flag_02, "", flags::SET_FLAGS_VALUE, flags::kProgrammaticChange, &err));
   EXPECT_EQ(absl::GetFlag(FLAGS_string_flag), "");
 }
@@ -179,14 +180,14 @@ TEST_F(CommandLineFlagTest, TestParseFromDefaultValue) {
 
   auto* flag_01 = flags::FindCommandLineFlag("int_flag");
 
-  EXPECT_TRUE(flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(flags::PrivateHandleAccessor::ParseFrom(
       flag_01, "111", flags::SET_FLAGS_DEFAULT, flags::kProgrammaticChange,
       &err));
   EXPECT_EQ(flag_01->DefaultValue(), "111");
 
   auto* flag_02 = flags::FindCommandLineFlag("string_flag");
 
-  EXPECT_TRUE(flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(flags::PrivateHandleAccessor::ParseFrom(
       flag_02, "abc", flags::SET_FLAGS_DEFAULT, flags::kProgrammaticChange,
       &err));
   EXPECT_EQ(flag_02->DefaultValue(), "abc");
@@ -199,24 +200,24 @@ TEST_F(CommandLineFlagTest, TestParseFromIfDefault) {
 
   auto* flag_01 = flags::FindCommandLineFlag("int_flag");
 
-  EXPECT_TRUE(flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(flags::PrivateHandleAccessor::ParseFrom(
       flag_01, "22", flags::SET_FLAG_IF_DEFAULT, flags::kProgrammaticChange,
       &err))
       << err;
   EXPECT_EQ(absl::GetFlag(FLAGS_int_flag), 22);
 
-  EXPECT_TRUE(flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(flags::PrivateHandleAccessor::ParseFrom(
       flag_01, "33", flags::SET_FLAG_IF_DEFAULT, flags::kProgrammaticChange,
       &err));
   EXPECT_EQ(absl::GetFlag(FLAGS_int_flag), 22);
   // EXPECT_EQ(err, "ERROR: int_flag is already set to 22");
 
   // Reset back to default value
-  EXPECT_TRUE(flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(flags::PrivateHandleAccessor::ParseFrom(
       flag_01, "201", flags::SET_FLAGS_VALUE, flags::kProgrammaticChange,
       &err));
 
-  EXPECT_TRUE(flags::PrivateHandleInterface::ParseFrom(
+  EXPECT_TRUE(flags::PrivateHandleAccessor::ParseFrom(
       flag_01, "33", flags::SET_FLAG_IF_DEFAULT, flags::kProgrammaticChange,
       &err));
   EXPECT_EQ(absl::GetFlag(FLAGS_int_flag), 201);