| 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 part 'test_utils.dart'; | 8 part 'test_utils.dart'; |
| 9 | 9 |
| 10 doesNotThrow() {} | 10 doesNotThrow() {} |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 group('Map Matchers', () { | 514 group('Map Matchers', () { |
| 515 | 515 |
| 516 test('isEmpty', () { | 516 test('isEmpty', () { |
| 517 var a = new Map(); | 517 var a = new Map(); |
| 518 shouldPass({}, isEmpty); | 518 shouldPass({}, isEmpty); |
| 519 shouldPass(a, isEmpty); | 519 shouldPass(a, isEmpty); |
| 520 a['foo'] = 'bar'; | 520 a['foo'] = 'bar'; |
| 521 shouldFail(a, isEmpty, "Expected: empty but: was <{foo: bar}>."); | 521 shouldFail(a, isEmpty, "Expected: empty but: was <{foo: bar}>."); |
| 522 }); | 522 }); |
| 523 | 523 |
| 524 test('equals', () { |
| 525 var a = new Map(); |
| 526 a['foo'] = 'bar'; |
| 527 var b = new Map(); |
| 528 b['foo'] = 'bar'; |
| 529 var c = new Map(); |
| 530 c['bar'] = 'foo'; |
| 531 shouldPass(a, equals(b)); |
| 532 shouldFail(b, equals(c), |
| 533 "Expected: <{bar: foo}> but: missing map key bar 'bar'."); |
| 534 }); |
| 535 |
| 524 test('contains', () { | 536 test('contains', () { |
| 525 var a = new Map(); | 537 var a = new Map(); |
| 526 a['foo'] = 'bar'; | 538 a['foo'] = 'bar'; |
| 527 var b = new Map(); | 539 var b = new Map(); |
| 528 shouldPass(a, contains('foo')); | 540 shouldPass(a, contains('foo')); |
| 529 shouldFail(b, contains('foo'), | 541 shouldFail(b, contains('foo'), |
| 530 "Expected: contains 'foo' but: was <{}>."); | 542 "Expected: contains 'foo' but: was <{}>."); |
| 531 shouldFail(10, contains('foo'), | 543 shouldFail(10, contains('foo'), |
| 532 "Expected: contains 'foo' but: was <10>."); | 544 "Expected: contains 'foo' but: was <10>."); |
| 533 }); | 545 }); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 var w = new Widget(); | 665 var w = new Widget(); |
| 654 w.price = 10; | 666 w.price = 10; |
| 655 shouldPass(w, new HasPrice(greaterThan(0))); | 667 shouldPass(w, new HasPrice(greaterThan(0))); |
| 656 shouldFail(w, new HasPrice(greaterThan(10)), | 668 shouldFail(w, new HasPrice(greaterThan(10)), |
| 657 'Expected: Widget with a price that is a value greater than <10> ' | 669 'Expected: Widget with a price that is a value greater than <10> ' |
| 658 'but: price was <10>.'); | 670 'but: price was <10>.'); |
| 659 }); | 671 }); |
| 660 }); | 672 }); |
| 661 } | 673 } |
| 662 | 674 |
| OLD | NEW |