OLD | NEW |
---|---|
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Description text of the current test group. If multiple groups are nested, | 6 * Description text of the current test group. If multiple groups are nested, |
7 * this will contain all of their text concatenated. | 7 * this will contain all of their text concatenated. |
8 */ | 8 */ |
9 String _currentGroup = ''; | 9 String _currentGroup = ''; |
10 | 10 |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 Expect.listEquals(expected, _value); | 301 Expect.listEquals(expected, _value); |
302 } | 302 } |
303 | 303 |
304 /** | 304 /** |
305 * Checks that every element of [expected] is also in [actual], and that | 305 * Checks that every element of [expected] is also in [actual], and that |
306 * every element of [actual] is also in [expected]. | 306 * every element of [actual] is also in [expected]. |
307 */ | 307 */ |
308 void equalsSet(Iterable expected) { | 308 void equalsSet(Iterable expected) { |
309 Expect.setEquals(expected, _value); | 309 Expect.setEquals(expected, _value); |
310 } | 310 } |
311 | |
312 /** | |
313 * Asserts that value is equivalent to [expected], assuming both are strings. | |
314 * When the strings differ, the error highlights the diff between them. | |
315 */ | |
316 void equalsString(String expected) { | |
Bob Nystrom
2012/02/08 19:17:43
Why don't we just make the regular equals() handle
Siggi Cherem (dart-lang)
2012/02/08 19:23:51
Done. I thought that the error message of stringEq
| |
317 Expect.stringEquals(expected, _value); | |
318 } | |
311 } | 319 } |
312 | 320 |
313 /** Summarizes information about a single test case. */ | 321 /** Summarizes information about a single test case. */ |
314 class TestCase { | 322 class TestCase { |
315 /** Identifier for this test. */ | 323 /** Identifier for this test. */ |
316 final id; | 324 final id; |
317 | 325 |
318 /** A description of what the test is specifying. */ | 326 /** A description of what the test is specifying. */ |
319 final String description; | 327 final String description; |
320 | 328 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
354 } | 362 } |
355 | 363 |
356 void error(String message_, String stackTrace_) { | 364 void error(String message_, String stackTrace_) { |
357 result = _ERROR; | 365 result = _ERROR; |
358 this.message = message_; | 366 this.message = message_; |
359 this.stackTrace = stackTrace_; | 367 this.stackTrace = stackTrace_; |
360 } | 368 } |
361 } | 369 } |
362 | 370 |
363 typedef void TestFunction(); | 371 typedef void TestFunction(); |
OLD | NEW |