| Index: base/command_line_unittest.cc
|
| ===================================================================
|
| --- base/command_line_unittest.cc (revision 66131)
|
| +++ base/command_line_unittest.cc (working copy)
|
| @@ -179,3 +179,30 @@
|
| EXPECT_TRUE(c1.HasSwitch("switch2"));
|
| }
|
|
|
| +// Make sure that the program part of a command line is always quoted.
|
| +TEST(CommandLineTest, ProgramQuotes) {
|
| + const FilePath kProgram(FILE_PATH_LITERAL("Program"));
|
| + const FilePath kProgramQuoted(FILE_PATH_LITERAL("\"Program\""));
|
| +
|
| + // Check that quotes are not returned from GetProgram().
|
| + CommandLine cl1(kProgram);
|
| + EXPECT_EQ(kProgram.value(), cl1.GetProgram().value());
|
| +
|
| + CommandLine cl2(kProgramQuoted);
|
| + EXPECT_EQ(kProgram.value(), cl2.GetProgram().value());
|
| +
|
| + CommandLine cl3(CommandLine::FromString(kProgramQuoted.value()));
|
| + EXPECT_EQ(kProgram.value(), cl3.GetProgram().value());
|
| +
|
| +#if defined(OS_WIN)
|
| + // Verify that in the command line string, the program part is always quoted.
|
| + CommandLine* check[] = {&cl1, &cl2, &cl3};
|
| + for (int i = 0; i < arraysize(check); ++i) {
|
| + CommandLine::StringType c(check[i]->command_line_string());
|
| + CommandLine::StringType p(check[i]->GetProgram().value());
|
| + EXPECT_EQ('"', c[0]);
|
| + EXPECT_EQ(p, c.substr(1, p.length()));
|
| + EXPECT_EQ('"', c[p.length() + 1]);
|
| + }
|
| +#endif
|
| +}
|
|
|