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 library unittestTests; | 5 library unittestTests; |
6 import 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 part 'test_utils.dart'; | 9 part 'test_utils.dart'; |
10 | 10 |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 shouldFail(e, isEmpty, "Expected: empty but: was <[1]>."); | 454 shouldFail(e, isEmpty, "Expected: empty but: was <[1]>."); |
455 }); | 455 }); |
456 | 456 |
457 test('contains', () { | 457 test('contains', () { |
458 var d = new SimpleIterable(3); | 458 var d = new SimpleIterable(3); |
459 shouldPass(d, contains(2)); | 459 shouldPass(d, contains(2)); |
460 shouldFail(d, contains(5), "Expected: contains <5> but: was <[3]>."); | 460 shouldFail(d, contains(5), "Expected: contains <5> but: was <[3]>."); |
461 }); | 461 }); |
462 }); | 462 }); |
463 | 463 |
464 group('Collection Matchers', () { | 464 group('Iterable Matchers', () { |
465 | 465 |
466 test('isEmpty', () { | 466 test('isEmpty', () { |
467 shouldPass([], isEmpty); | 467 shouldPass([], isEmpty); |
468 shouldFail([1], isEmpty, "Expected: empty but: was <[1]>."); | 468 shouldFail([1], isEmpty, "Expected: empty but: was <[1]>."); |
469 }); | 469 }); |
470 | 470 |
471 test('contains', () { | 471 test('contains', () { |
472 var d = [1, 2]; | 472 var d = [1, 2]; |
473 shouldPass(d, contains(1)); | 473 shouldPass(d, contains(1)); |
474 shouldFail(d, contains(0), "Expected: contains <0> but: was <[1, 2]>."); | 474 shouldFail(d, contains(0), "Expected: contains <0> but: was <[1, 2]>."); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 var w = new Widget(); | 703 var w = new Widget(); |
704 w.price = 10; | 704 w.price = 10; |
705 shouldPass(w, new HasPrice(greaterThan(0))); | 705 shouldPass(w, new HasPrice(greaterThan(0))); |
706 shouldFail(w, new HasPrice(greaterThan(10)), | 706 shouldFail(w, new HasPrice(greaterThan(10)), |
707 'Expected: Widget with a price that is a value greater than <10> ' | 707 'Expected: Widget with a price that is a value greater than <10> ' |
708 'but: price was <10>.'); | 708 'but: price was <10>.'); |
709 }); | 709 }); |
710 }); | 710 }); |
711 } | 711 } |
712 | 712 |
OLD | NEW |