diff options
author | 2020-05-08 10:36:00 -0700 | |
---|---|---|
committer | 2020-05-08 15:22:38 -0400 | |
commit | c45d1c09d517e145d722e00deea9be6c8be8dd57 (patch) | |
tree | 6db7d9f18aeb714064b25fd11ade71f3d2fbe3ae /absl/flags/parse_test.cc | |
parent | a35ef8a62ce7cded2f131ccbd2b5c4a81d622507 (diff) |
Export of internal Abseil changes
--
47f13ea42ae272c995b1cd5073a45e046fa325eb by Matthew Brown <matthewbr@google.com>:
absl::StrFormat: Centralize FormatConversionCharSet vs FormatConversionSpec checking
- Move it into a central location, rather than requiring individual overloads to
validate.
PiperOrigin-RevId: 310583805
--
a567c8fc8032031d551d6b457755851f442e65ad by Gennadiy Rozental <rogeeff@google.com>:
Internal change
PiperOrigin-RevId: 310427635
--
49848f7fab9b0f528d33f60cbccf688e2ea68afa by Gennadiy Rozental <rogeeff@google.com>:
Make Get/Set private methods of absl::Flag<T>.
PiperOrigin-RevId: 310413908
GitOrigin-RevId: 47f13ea42ae272c995b1cd5073a45e046fa325eb
Change-Id: I6530c754731c1a9463877561fa61786460ed60af
Diffstat (limited to 'absl/flags/parse_test.cc')
-rw-r--r-- | absl/flags/parse_test.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/absl/flags/parse_test.cc b/absl/flags/parse_test.cc index 065f757a..e6a53ae6 100644 --- a/absl/flags/parse_test.cc +++ b/absl/flags/parse_test.cc @@ -869,4 +869,26 @@ TEST_F(ParseDeathTest, TestHelpFlagHandling) { EXPECT_EQ(absl::GetFlag(FLAGS_int_flag), 3); } +// -------------------------------------------------------------------- + +TEST_F(ParseTest, WasPresentOnCommandLine) { + const char* in_args1[] = { + "testbin", "arg1", "--bool_flag", + "--int_flag=211", "arg2", "--double_flag=1.1", + "--string_flag", "asd", "--", + "--some_flag", "arg4", + }; + + InvokeParse(in_args1); + + EXPECT_TRUE(flags::WasPresentOnCommandLine("bool_flag")); + EXPECT_TRUE(flags::WasPresentOnCommandLine("int_flag")); + EXPECT_TRUE(flags::WasPresentOnCommandLine("double_flag")); + EXPECT_TRUE(flags::WasPresentOnCommandLine("string_flag")); + EXPECT_FALSE(flags::WasPresentOnCommandLine("some_flag")); + EXPECT_FALSE(flags::WasPresentOnCommandLine("another_flag")); +} + +// -------------------------------------------------------------------- + } // namespace |