diff options
author | Cronet Mainline Eng <cronet-mainline-eng+copybara@google.com> | 2023-03-22 02:58:49 -0800 |
---|---|---|
committer | Patrick Rohr <prohr@google.com> | 2023-03-22 04:40:18 -0700 |
commit | c175721cfcc03e339122be17d569239df9762b2b (patch) | |
tree | 64fed42a909067904ef77b573e554a172241bdfe /base/command_line_unittest.cc | |
parent | 26b17131b27be4b84fc089d96dcc1998e686ecf9 (diff) | |
download | cronet-c175721cfcc03e339122be17d569239df9762b2b.tar.gz |
Import Cronet version 110.0.5481.154
Project import generated by Copybara.
FolderOrigin-RevId: /tmp/copybara-origin/src
Test: none
Change-Id: I534a69efa61b40fdc95613bce5bc5dd9a432f646
Diffstat (limited to 'base/command_line_unittest.cc')
-rw-r--r-- | base/command_line_unittest.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc index f900a90f5..04d2201ee 100644 --- a/base/command_line_unittest.cc +++ b/base/command_line_unittest.cc @@ -338,6 +338,20 @@ TEST(CommandLineTest, HasSingleArgument) { EXPECT_TRUE(cl_for_shell.HasSingleArgumentSwitch()); } +// Test that creating a new command line from the string version of a single +// argument command line maintains the single argument switch, and the +// argument. +TEST(CommandLineTest, MaintainSingleArgument) { + // Putting a space in the file name will force escaping of the argument. + static const CommandLine::StringType kCommandLine = + FILE_PATH_LITERAL("program --switch --single-argument foo bar.html"); + CommandLine cl = CommandLine::FromString(kCommandLine); + CommandLine cl_for_shell = CommandLine::FromString(cl.GetCommandLineString()); + EXPECT_TRUE(cl_for_shell.HasSingleArgumentSwitch()); + // Verify that we command line survives the round trip with an escaped arg. + EXPECT_EQ(kCommandLine, cl_for_shell.GetCommandLineString()); +} + #endif // BUILDFLAG(IS_WIN) // Tests that when AppendArguments is called that the program is set correctly |