OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 | 7 |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
9 | 9 |
10 import 'test_utils.dart'; | 10 import 'test_utils.dart'; |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 shouldFail(d, unorderedEquals([3, 2, 1]), | 477 shouldFail(d, unorderedEquals([3, 2, 1]), |
478 "Expected: equals [3, 2, 1] unordered " | 478 "Expected: equals [3, 2, 1] unordered " |
479 "Actual: [1, 2] " | 479 "Actual: [1, 2] " |
480 "Which: has too few elements (2 < 3)"); | 480 "Which: has too few elements (2 < 3)"); |
481 shouldFail(d, unorderedEquals([3, 1]), | 481 shouldFail(d, unorderedEquals([3, 1]), |
482 "Expected: equals [3, 1] unordered " | 482 "Expected: equals [3, 1] unordered " |
483 "Actual: [1, 2] " | 483 "Actual: [1, 2] " |
484 "Which: has no match for element <3> at index 0"); | 484 "Which: has no match for element <3> at index 0"); |
485 }); | 485 }); |
486 | 486 |
| 487 test('unorderedMatchess', () { |
| 488 var d = [1, 2]; |
| 489 shouldPass(d, unorderedMatches([2, 1])); |
| 490 shouldPass(d, unorderedMatches([greaterThan(1), greaterThan(0)])); |
| 491 shouldFail(d, unorderedMatches([greaterThan(0)]), |
| 492 "Expected: matches [a value greater than <0>] unordered " |
| 493 "Actual: [1, 2] " |
| 494 "Which: has too many elements (2 > 1)"); |
| 495 shouldFail(d, unorderedMatches([3, 2, 1]), |
| 496 "Expected: matches [<3>, <2>, <1>] unordered " |
| 497 "Actual: [1, 2] " |
| 498 "Which: has too few elements (2 < 3)"); |
| 499 shouldFail(d, unorderedMatches([3, 1]), |
| 500 "Expected: matches [<3>, <1>] unordered " |
| 501 "Actual: [1, 2] " |
| 502 "Which: has no match for <3> at index 0"); |
| 503 shouldFail(d, unorderedMatches([greaterThan(3), greaterThan(0)]), |
| 504 "Expected: matches [a value greater than <3>, a value greater than " |
| 505 "<0>] unordered " |
| 506 "Actual: [1, 2] " |
| 507 "Which: has no match for a value greater than <3> at index 0"); |
| 508 }); |
| 509 |
487 test('pairwise compare', () { | 510 test('pairwise compare', () { |
488 var c = [1, 2]; | 511 var c = [1, 2]; |
489 var d = [1, 2, 3]; | 512 var d = [1, 2, 3]; |
490 var e = [1, 4, 9]; | 513 var e = [1, 4, 9]; |
491 shouldFail('x', pairwiseCompare(e, (e,a) => a <= e, | 514 shouldFail('x', pairwiseCompare(e, (e,a) => a <= e, |
492 "less than or equal"), | 515 "less than or equal"), |
493 "Expected: pairwise less than or equal [1, 4, 9] " | 516 "Expected: pairwise less than or equal [1, 4, 9] " |
494 "Actual: 'x' " | 517 "Actual: 'x' " |
495 "Which: is not an Iterable"); | 518 "Which: is not an Iterable"); |
496 shouldFail(c, pairwiseCompare(e, (e,a) => a <= e, "less than or equal"), | 519 shouldFail(c, pairwiseCompare(e, (e,a) => a <= e, "less than or equal"), |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 | 779 |
757 X() { | 780 X() { |
758 print(foo); | 781 print(foo); |
759 } | 782 } |
760 } | 783 } |
761 | 784 |
762 abstract class Abstraction { | 785 abstract class Abstraction { |
763 void norealization(); | 786 void norealization(); |
764 } | 787 } |
765 | 788 |
OLD | NEW |