diff options
author | mgiuca <mgiuca@chromium.org> | 2014-09-23 21:55:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-24 04:55:45 +0000 |
commit | b937b24239d36fb4cdfeb98b2db818e4304dd8b4 (patch) | |
tree | 807c2e6e41a3ba1cb369ec934ed1c7d67d7a72b6 | |
parent | df2931a70908043e07de24d3fa48c25cb68d7dc1 (diff) | |
download | chromium_src-b937b24239d36fb4cdfeb98b2db818e4304dd8b4.zip chromium_src-b937b24239d36fb4cdfeb98b2db818e4304dd8b4.tar.gz chromium_src-b937b24239d36fb4cdfeb98b2db818e4304dd8b4.tar.bz2 |
CommandLineTest.ProgramQuotes: Fix crash-prone test.
Previously, this test would crash if the output wasn't quoted properly
(since it assumes that cmd_string.length() >= program_string.length() +
2). Instead, directly compare the string with the expected output. This
also guards against the possibility of mis-constructing the expected
string.
Review URL: https://codereview.chromium.org/589393002
Cr-Commit-Position: refs/heads/master@{#296350}
-rw-r--r-- | base/command_line_unittest.cc | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc index 06c5006..8aed618 100644 --- a/base/command_line_unittest.cc +++ b/base/command_line_unittest.cc @@ -348,10 +348,7 @@ TEST(CommandLineTest, ProgramQuotes) { // Check that quotes are added to command line string paths containing spaces. CommandLine::StringType cmd_string(cl_program_path.GetCommandLineString()); - CommandLine::StringType program_string(cl_program_path.GetProgram().value()); - EXPECT_EQ('"', cmd_string[0]); - EXPECT_EQ(program_string, cmd_string.substr(1, program_string.length())); - EXPECT_EQ('"', cmd_string[program_string.length() + 1]); + EXPECT_EQ(L"\"Program Path\"", cmd_string); } #endif |