OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 EXPECT_TRUE(cl.HasSwitch("foo")); | 44 EXPECT_TRUE(cl.HasSwitch("foo")); |
45 EXPECT_TRUE(cl.HasSwitch("bar")); | 45 EXPECT_TRUE(cl.HasSwitch("bar")); |
46 EXPECT_TRUE(cl.HasSwitch("baz")); | 46 EXPECT_TRUE(cl.HasSwitch("baz")); |
47 EXPECT_TRUE(cl.HasSwitch("spaetzle")); | 47 EXPECT_TRUE(cl.HasSwitch("spaetzle")); |
48 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
49 EXPECT_TRUE(cl.HasSwitch("SPAETZLE")); | 49 EXPECT_TRUE(cl.HasSwitch("SPAETZLE")); |
50 #endif | 50 #endif |
51 EXPECT_TRUE(cl.HasSwitch("other-switches")); | 51 EXPECT_TRUE(cl.HasSwitch("other-switches")); |
52 EXPECT_TRUE(cl.HasSwitch("input-translation")); | 52 EXPECT_TRUE(cl.HasSwitch("input-translation")); |
53 | 53 |
54 EXPECT_EQ(L"Crepe", cl.GetSwitchValue("spaetzle")); | 54 EXPECT_EQ("Crepe", cl.GetSwitchValueASCII("spaetzle")); |
55 EXPECT_EQ(L"", cl.GetSwitchValue("Foo")); | 55 EXPECT_EQ("", cl.GetSwitchValueASCII("Foo")); |
56 EXPECT_EQ(L"", cl.GetSwitchValue("bar")); | 56 EXPECT_EQ("", cl.GetSwitchValueASCII("bar")); |
57 EXPECT_EQ(L"", cl.GetSwitchValue("cruller")); | 57 EXPECT_EQ("", cl.GetSwitchValueASCII("cruller")); |
58 EXPECT_EQ(L"--dog=canine --cat=feline", cl.GetSwitchValue("other-switches")); | 58 EXPECT_EQ("--dog=canine --cat=feline", cl.GetSwitchValueASCII( |
59 EXPECT_EQ(L"45--output-rotation", cl.GetSwitchValue("input-translation")); | 59 "other-switches")); |
| 60 EXPECT_EQ("45--output-rotation", cl.GetSwitchValueASCII("input-translation")); |
60 | 61 |
61 std::vector<std::wstring> loose_values = cl.GetLooseValues(); | 62 std::vector<std::wstring> loose_values = cl.GetLooseValues(); |
62 ASSERT_EQ(5U, loose_values.size()); | 63 ASSERT_EQ(5U, loose_values.size()); |
63 | 64 |
64 std::vector<std::wstring>::const_iterator iter = loose_values.begin(); | 65 std::vector<std::wstring>::const_iterator iter = loose_values.begin(); |
65 EXPECT_EQ(L"flim", *iter); | 66 EXPECT_EQ(L"flim", *iter); |
66 ++iter; | 67 ++iter; |
67 EXPECT_EQ(L"flan", *iter); | 68 EXPECT_EQ(L"flan", *iter); |
68 ++iter; | 69 ++iter; |
69 EXPECT_EQ(L"--", *iter); | 70 EXPECT_EQ(L"--", *iter); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 cl.AppendSwitchWithValue(switch4, value4); | 114 cl.AppendSwitchWithValue(switch4, value4); |
114 | 115 |
115 EXPECT_TRUE(cl.HasSwitch(switch1)); | 116 EXPECT_TRUE(cl.HasSwitch(switch1)); |
116 EXPECT_TRUE(cl.HasSwitch(switch2)); | 117 EXPECT_TRUE(cl.HasSwitch(switch2)); |
117 EXPECT_EQ(value, cl.GetSwitchValue(switch2)); | 118 EXPECT_EQ(value, cl.GetSwitchValue(switch2)); |
118 EXPECT_TRUE(cl.HasSwitch(switch3)); | 119 EXPECT_TRUE(cl.HasSwitch(switch3)); |
119 EXPECT_EQ(value3, cl.GetSwitchValue(switch3)); | 120 EXPECT_EQ(value3, cl.GetSwitchValue(switch3)); |
120 EXPECT_TRUE(cl.HasSwitch(switch4)); | 121 EXPECT_TRUE(cl.HasSwitch(switch4)); |
121 EXPECT_EQ(value4, cl.GetSwitchValue(switch4)); | 122 EXPECT_EQ(value4, cl.GetSwitchValue(switch4)); |
122 } | 123 } |
OLD | NEW |