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/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/string_util.h" | |
12 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
13 | 12 |
14 // To test Windows quoting behavior, we use a string that has some backslashes | 13 // To test Windows quoting behavior, we use a string that has some backslashes |
15 // and quotes. | 14 // and quotes. |
16 // Consider the command-line argument: q\"bs1\bs2\\bs3q\\\" | 15 // Consider the command-line argument: q\"bs1\bs2\\bs3q\\\" |
17 // Here it is with C-style escapes. | 16 // Here it is with C-style escapes. |
18 #define TRICKY_QUOTED L"q\\\"bs1\\bs2\\\\bs3q\\\\\\\"" | 17 #define TRICKY_QUOTED L"q\\\"bs1\\bs2\\\\bs3q\\\\\\\"" |
19 // It should be parsed by Windows as: q"bs1\bs2\\bs3q\" | 18 // It should be parsed by Windows as: q"bs1\bs2\\bs3q\" |
20 // Here that is with C-style escapes. | 19 // Here that is with C-style escapes. |
21 #define TRICKY L"q\"bs1\\bs2\\\\bs3q\\\"" | 20 #define TRICKY L"q\"bs1\\bs2\\\\bs3q\\\"" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 #if defined(OS_WIN) | 145 #if defined(OS_WIN) |
147 EXPECT_EQ(L"\"Program\" " | 146 EXPECT_EQ(L"\"Program\" " |
148 L"--switch1 " | 147 L"--switch1 " |
149 L"--switch2=value " | 148 L"--switch2=value " |
150 L"--switch3=\"a value with spaces\" " | 149 L"--switch3=\"a value with spaces\" " |
151 L"--switch4=\"\\\"a value with quotes\\\"\" " | 150 L"--switch4=\"\\\"a value with quotes\\\"\" " |
152 L"--quotes=\"" TRICKY_QUOTED L"\"", | 151 L"--quotes=\"" TRICKY_QUOTED L"\"", |
153 cl.command_line_string()); | 152 cl.command_line_string()); |
154 #endif | 153 #endif |
155 } | 154 } |
OLD | NEW |