Index: base/command_line_unittest.cc |
=================================================================== |
--- base/command_line_unittest.cc (revision 67576) |
+++ base/command_line_unittest.cc (working copy) |
@@ -179,3 +179,22 @@ |
EXPECT_TRUE(c1.HasSwitch("switch2")); |
} |
+#if defined(OS_WIN) |
+// Make sure that the program part of a command line is always quoted. |
+// This only makes sense on Windows and the test is basically here to guard |
+// against regressions. |
+TEST(CommandLineTest, ProgramQuotes) { |
+ const FilePath kProgram(FILE_PATH_LITERAL("Program")); |
Evan Martin
2010/11/29 20:39:55
Since you're in a Windows-specific branch, L"Progr
tommi (sloooow) - chröme
2010/11/29 20:45:01
Done.
|
+ |
+ // Check that quotes are not returned from GetProgram(). |
+ CommandLine cl(kProgram); |
+ EXPECT_EQ(kProgram.value(), cl.GetProgram().value()); |
+ |
+ // Verify that in the command line string, the program part is always quoted. |
+ CommandLine::StringType cmd(cl.command_line_string()); |
+ CommandLine::StringType program(cl.GetProgram().value()); |
+ EXPECT_EQ('"', cmd[0]); |
+ EXPECT_EQ(program, cmd.substr(1, program.length())); |
+ EXPECT_EQ('"', cmd[program.length() + 1]); |
+} |
+#endif |