diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-13 15:45:34 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-13 15:45:34 +0000 |
commit | 1fa39f057d59aeee2b9f36cf3b152528a1197ae1 (patch) | |
tree | b7aa03c2bb6d8e79f636252eda7fab02b059cd14 /base/command_line_unittest.cc | |
parent | 691a97e5081651a1df05eb9a59b6ce111e949350 (diff) | |
download | chromium_src-1fa39f057d59aeee2b9f36cf3b152528a1197ae1.zip chromium_src-1fa39f057d59aeee2b9f36cf3b152528a1197ae1.tar.gz chromium_src-1fa39f057d59aeee2b9f36cf3b152528a1197ae1.tar.bz2 |
micro optimize CommandLine.GetSwitchPrefixLength
avoid searching the entire length of each switch for the -- prefix, as we know it can only exist at the start.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/7866036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100918 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/command_line_unittest.cc')
-rw-r--r-- | base/command_line_unittest.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc index 80874ac..656236e 100644 --- a/base/command_line_unittest.cc +++ b/base/command_line_unittest.cc @@ -34,6 +34,7 @@ TEST(CommandLineTest, CommandLineConstructor) { FILE_PATH_LITERAL("-spaetzle=Crepe"), FILE_PATH_LITERAL("-=loosevalue"), FILE_PATH_LITERAL("FLAN"), + FILE_PATH_LITERAL("a"), FILE_PATH_LITERAL("--input-translation=45--output-rotation"), FILE_PATH_LITERAL("--"), FILE_PATH_LITERAL("--"), @@ -74,13 +75,15 @@ TEST(CommandLineTest, CommandLineConstructor) { EXPECT_EQ("45--output-rotation", cl.GetSwitchValueASCII("input-translation")); const CommandLine::StringVector& args = cl.GetArgs(); - ASSERT_EQ(6U, args.size()); + ASSERT_EQ(7U, args.size()); std::vector<CommandLine::StringType>::const_iterator iter = args.begin(); EXPECT_EQ(FILE_PATH_LITERAL("flim"), *iter); ++iter; EXPECT_EQ(FILE_PATH_LITERAL("FLAN"), *iter); ++iter; + EXPECT_EQ(FILE_PATH_LITERAL("a"), *iter); + ++iter; EXPECT_EQ(FILE_PATH_LITERAL("--"), *iter); ++iter; EXPECT_EQ(FILE_PATH_LITERAL("--not-a-switch"), *iter); |