OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/test/expectations/parser.h" | 5 #include "base/test/expectations/parser.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 154 } |
155 | 155 |
156 TEST_F(TestExpectationParserTest, WeirdSpaces) { | 156 TEST_F(TestExpectationParserTest, WeirdSpaces) { |
157 Parser(this, " BUG [Linux] Weird = Skip ").Parse(); | 157 Parser(this, " BUG [Linux] Weird = Skip ").Parse(); |
158 EXPECT_EQ(1u, expectations_.size()); | 158 EXPECT_EQ(1u, expectations_.size()); |
159 EXPECT_TRUE(syntax_error_.empty()); | 159 EXPECT_TRUE(syntax_error_.empty()); |
160 EXPECT_EQ(0u, data_errors_.size()); | 160 EXPECT_EQ(0u, data_errors_.size()); |
161 } | 161 } |
162 | 162 |
163 TEST_F(TestExpectationParserTest, SyntaxErrors) { | 163 TEST_F(TestExpectationParserTest, SyntaxErrors) { |
164 const char* kErrors[] = { | 164 const char* const kErrors[] = { |
165 "Foo [ dfasd", | 165 "Foo [ dfasd", |
166 "Foo [Linux] # This is an illegal comment", | 166 "Foo [Linux] # This is an illegal comment", |
167 "Foo [Linux] Bar # Another illegal comment.", | 167 "Foo [Linux] Bar # Another illegal comment.", |
168 "Foo [Linux] Bar = # Another illegal comment.", | 168 "Foo [Linux] Bar = # Another illegal comment.", |
169 "Foo[Linux]Bar=Failure", | 169 "Foo[Linux]Bar=Failure", |
170 "Foo\n[Linux] Bar = Failure", | 170 "Foo\n[Linux] Bar = Failure", |
171 "Foo [\nLinux] Bar = Failure", | 171 "Foo [\nLinux] Bar = Failure", |
172 "Foo [Linux\n] Bar = Failure", | 172 "Foo [Linux\n] Bar = Failure", |
173 "Foo [ Linux ] \n Bar = Failure", | 173 "Foo [ Linux ] \n Bar = Failure", |
174 "Foo [ Linux ] Bar =\nFailure", | 174 "Foo [ Linux ] Bar =\nFailure", |
175 "Foo [ Linux \n ] Bar =\nFailure", | 175 "Foo [ Linux \n ] Bar =\nFailure", |
176 }; | 176 }; |
177 | 177 |
178 for (size_t i = 0; i < arraysize(kErrors); ++i) { | 178 for (size_t i = 0; i < arraysize(kErrors); ++i) { |
179 Parser(this, kErrors[i]).Parse(); | 179 Parser(this, kErrors[i]).Parse(); |
180 EXPECT_FALSE(syntax_error_.empty()) | 180 EXPECT_FALSE(syntax_error_.empty()) |
181 << "Should have error for #" << i << ": " << kErrors[i]; | 181 << "Should have error for #" << i << ": " << kErrors[i]; |
182 syntax_error_.clear(); | 182 syntax_error_.clear(); |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 TEST_F(TestExpectationParserTest, DataErrors) { | 186 TEST_F(TestExpectationParserTest, DataErrors) { |
187 const char* kOneError[] = { | 187 const char* const kOneError[] = { |
188 "http://crbug.com/1234 [MagicBrowzR] BadModifier = Timeout", | 188 "http://crbug.com/1234 [MagicBrowzR] BadModifier = Timeout", |
189 "________ [Linux] BadResult = WhatNow", | 189 "________ [Linux] BadResult = WhatNow", |
190 "http://wkb.ug/1234 [Debug Release Win-7] MultipleConfigs = Skip", | 190 "http://wkb.ug/1234 [Debug Release Win-7] MultipleConfigs = Skip", |
191 }; | 191 }; |
192 | 192 |
193 for (size_t i = 0; i < arraysize(kOneError); ++i) { | 193 for (size_t i = 0; i < arraysize(kOneError); ++i) { |
194 Parser(this, kOneError[i]).Parse(); | 194 Parser(this, kOneError[i]).Parse(); |
195 EXPECT_EQ(1u, data_errors_.size()) << kOneError[i]; | 195 EXPECT_EQ(1u, data_errors_.size()) << kOneError[i]; |
196 data_errors_.clear(); | 196 data_errors_.clear(); |
197 } | 197 } |
198 | 198 |
199 const char* kTwoErrors[] = { | 199 const char* const kTwoErrors[] = { |
200 ". [Mac-TurningIntoiOS] BadModifierVariant.BadResult = Foobar", | 200 ". [Mac-TurningIntoiOS] BadModifierVariant.BadResult = Foobar", |
201 "1234 [ Debug Release OS/2 ] MultipleConfigs.BadModifier = Pass", | 201 "1234 [ Debug Release OS/2 ] MultipleConfigs.BadModifier = Pass", |
202 }; | 202 }; |
203 | 203 |
204 for (size_t i = 0; i < arraysize(kTwoErrors); ++i) { | 204 for (size_t i = 0; i < arraysize(kTwoErrors); ++i) { |
205 Parser(this, kTwoErrors[i]).Parse(); | 205 Parser(this, kTwoErrors[i]).Parse(); |
206 EXPECT_EQ(2u, data_errors_.size()) << kTwoErrors[i]; | 206 EXPECT_EQ(2u, data_errors_.size()) << kTwoErrors[i]; |
207 data_errors_.clear(); | 207 data_errors_.clear(); |
208 } | 208 } |
209 } | 209 } |
OLD | NEW |