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_common.dart'; | 10 import 'test_common.dart'; |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 "an object with length of a value greater than <0>) at index 2"); | 443 "an object with length of a value greater than <0>) at index 2"); |
444 shouldFail(e, everyElement(allOf(contains('foo'), | 444 shouldFail(e, everyElement(allOf(contains('foo'), |
445 hasLength(greaterThan(0)))), | 445 hasLength(greaterThan(0)))), |
446 "Expected: every element((contains 'foo' and an object with " | 446 "Expected: every element((contains 'foo' and an object with " |
447 "length of a value greater than <0>)) " | 447 "length of a value greater than <0>)) " |
448 "Actual: [['foo', 'bar'], ['foo'], 3, []] " | 448 "Actual: [['foo', 'bar'], ['foo'], 3, []] " |
449 "Which: has value <3> which is not a string, map or iterable " | 449 "Which: has value <3> which is not a string, map or iterable " |
450 "at index 2"); | 450 "at index 2"); |
451 }); | 451 }); |
452 | 452 |
453 test('someElement', () { | 453 test('anyElement', () { |
454 var d = [1, 2]; | 454 var d = [1, 2]; |
455 var e = [1, 1, 1]; | 455 var e = [1, 1, 1]; |
456 shouldPass(d, someElement(2)); | 456 shouldPass(d, anyElement(2)); |
457 shouldFail(e, someElement(2), | 457 shouldFail(e, anyElement(2), |
458 "Expected: some element <2> Actual: [1, 1, 1]"); | 458 "Expected: some element <2> Actual: [1, 1, 1]"); |
459 }); | 459 }); |
460 | 460 |
461 test('orderedEquals', () { | 461 test('orderedEquals', () { |
462 shouldPass([null], orderedEquals([null])); | 462 shouldPass([null], orderedEquals([null])); |
463 var d = [1, 2]; | 463 var d = [1, 2]; |
464 shouldPass(d, orderedEquals([1, 2])); | 464 shouldPass(d, orderedEquals([1, 2])); |
465 shouldFail(d, orderedEquals([2, 1]), | 465 shouldFail(d, orderedEquals([2, 1]), |
466 "Expected: equals [2, 1] ordered " | 466 "Expected: equals [2, 1] ordered " |
467 "Actual: [1, 2] " | 467 "Actual: [1, 2] " |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 | 701 |
702 group('Predicate Matchers', () { | 702 group('Predicate Matchers', () { |
703 test('isInstanceOf', () { | 703 test('isInstanceOf', () { |
704 shouldFail(0, predicate((x) => x is String, "an instance of String"), | 704 shouldFail(0, predicate((x) => x is String, "an instance of String"), |
705 "Expected: an instance of String Actual: <0>"); | 705 "Expected: an instance of String Actual: <0>"); |
706 shouldPass('cow', predicate((x) => x is String, "an instance of String")); | 706 shouldPass('cow', predicate((x) => x is String, "an instance of String")); |
707 }); | 707 }); |
708 }); | 708 }); |
709 } | 709 } |
710 | 710 |
OLD | NEW |