summaryrefslogtreecommitdiff
path: root/absl/flags
diff options
context:
space:
mode:
Diffstat (limited to 'absl/flags')
-rw-r--r--absl/flags/commandlineflag_test.cc12
-rw-r--r--absl/flags/internal/program_name_test.cc4
-rw-r--r--absl/flags/parse_test.cc4
3 files changed, 13 insertions, 7 deletions
diff --git a/absl/flags/commandlineflag_test.cc b/absl/flags/commandlineflag_test.cc
index c5afff61..585db4ba 100644
--- a/absl/flags/commandlineflag_test.cc
+++ b/absl/flags/commandlineflag_test.cc
@@ -34,6 +34,10 @@ ABSL_FLAG(std::string, string_flag, "dflt",
absl::StrCat("string_flag", " help"));
ABSL_RETIRED_FLAG(bool, bool_retired_flag, false, "bool_retired_flag help");
+// These are only used to test default values.
+ABSL_FLAG(int, int_flag2, 201, "");
+ABSL_FLAG(std::string, string_flag2, "dflt", "");
+
namespace {
namespace flags = absl::flags_internal;
@@ -94,15 +98,15 @@ TEST_F(CommandLineFlagTest, TestAttributesAccessMethods) {
// --------------------------------------------------------------------
TEST_F(CommandLineFlagTest, TestValueAccessMethods) {
- absl::SetFlag(&FLAGS_int_flag, 301);
- auto* flag_01 = absl::FindCommandLineFlag("int_flag");
+ absl::SetFlag(&FLAGS_int_flag2, 301);
+ auto* flag_01 = absl::FindCommandLineFlag("int_flag2");
ASSERT_TRUE(flag_01);
EXPECT_EQ(flag_01->CurrentValue(), "301");
EXPECT_EQ(flag_01->DefaultValue(), "201");
- absl::SetFlag(&FLAGS_string_flag, "new_str_value");
- auto* flag_02 = absl::FindCommandLineFlag("string_flag");
+ absl::SetFlag(&FLAGS_string_flag2, "new_str_value");
+ auto* flag_02 = absl::FindCommandLineFlag("string_flag2");
ASSERT_TRUE(flag_02);
EXPECT_EQ(flag_02->CurrentValue(), "new_str_value");
diff --git a/absl/flags/internal/program_name_test.cc b/absl/flags/internal/program_name_test.cc
index 269142f2..aff9f631 100644
--- a/absl/flags/internal/program_name_test.cc
+++ b/absl/flags/internal/program_name_test.cc
@@ -25,7 +25,7 @@ namespace {
namespace flags = absl::flags_internal;
-TEST(FlagsPathUtilTest, TestInitialProgamName) {
+TEST(FlagsPathUtilTest, TestProgamNameInterfaces) {
flags::SetProgramInvocationName("absl/flags/program_name_test");
std::string program_name = flags::ProgramInvocationName();
for (char& c : program_name)
@@ -43,9 +43,7 @@ TEST(FlagsPathUtilTest, TestInitialProgamName) {
EXPECT_TRUE(absl::EndsWith(program_name, expect_name)) << program_name;
EXPECT_EQ(flags::ShortProgramInvocationName(), expect_basename);
-}
-TEST(FlagsPathUtilTest, TestProgamNameInterfaces) {
flags::SetProgramInvocationName("a/my_test");
EXPECT_EQ(flags::ProgramInvocationName(), "a/my_test");
diff --git a/absl/flags/parse_test.cc b/absl/flags/parse_test.cc
index 67ae8aad..d35a6e47 100644
--- a/absl/flags/parse_test.cc
+++ b/absl/flags/parse_test.cc
@@ -637,6 +637,10 @@ TEST_F(ParseTest, TestFlagfileInFlagfile) {
"--flagfile=$0/parse_test.ff2",
};
+ GetFlagfileFlag({{"parse_test.ff2", absl::MakeConstSpan(ff2_data)},
+ {"parse_test.ff1", absl::MakeConstSpan(ff1_data)}},
+ flagfile_flag);
+
const char* in_args1[] = {
"testbin",
GetFlagfileFlag({{"parse_test.ff3", absl::MakeConstSpan(ff3_data)}},