| 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 }); | 699 }); |
| 700 }); | 700 }); |
| 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 |
| 710 group('exception/error matchers', () { |
| 711 // TODO(gram): extend this to more types; for now this is just |
| 712 // the types being added in this CL. |
| 713 |
| 714 // TODO: enable this test when it works. |
| 715 // See issue 12052. |
| 716 skip_test('throwsCyclicInitializationError', () { |
| 717 expect(() => new Bicycle(), throwsCyclicInitializationError); |
| 718 }); |
| 719 |
| 720 test('throwsAbstractClassInstantiationError', () { |
| 721 expect(() => new Abstraction(), throwsAbstractClassInstantiationError); |
| 722 }); |
| 723 |
| 724 test('throwsConcurrentModificationError', () { |
| 725 expect(() { |
| 726 var a = { 'foo': 'bar' }; |
| 727 for (var k in a.keys) { |
| 728 a.remove(k); |
| 729 } |
| 730 }, throwsConcurrentModificationError); |
| 731 }); |
| 732 |
| 733 test('throwsNullThrownError', () { |
| 734 expect(() => throw null, throwsNullThrownError); |
| 735 }); |
| 736 |
| 737 test('throwsFallThroughError', () { |
| 738 expect(() { |
| 739 var a = 0; |
| 740 switch (a) { |
| 741 case 0: |
| 742 a += 1; |
| 743 case 1: |
| 744 return; |
| 745 } |
| 746 }, throwsFallThroughError); |
| 747 }); |
| 748 }); |
| 709 } | 749 } |
| 710 | 750 |
| 751 class Bicycle { |
| 752 static var foo = bar(); |
| 753 |
| 754 static bar() { |
| 755 return foo + 1; |
| 756 } |
| 757 |
| 758 X() { |
| 759 print(foo); |
| 760 } |
| 761 } |
| 762 |
| 763 abstract class Abstraction { |
| 764 void norealization(); |
| 765 } |
| 766 |
| OLD | NEW |