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 715 matching lines...) Loading... | |
726 shouldFail(0, predicate((x) => x is String, "an instance of String"), | 726 shouldFail(0, predicate((x) => x is String, "an instance of String"), |
727 "Expected: an instance of String Actual: <0>"); | 727 "Expected: an instance of String Actual: <0>"); |
728 shouldPass('cow', predicate((x) => x is String, "an instance of String")); | 728 shouldPass('cow', predicate((x) => x is String, "an instance of String")); |
729 }); | 729 }); |
730 }); | 730 }); |
731 | 731 |
732 group('exception/error matchers', () { | 732 group('exception/error matchers', () { |
733 // TODO(gram): extend this to more types; for now this is just | 733 // TODO(gram): extend this to more types; for now this is just |
734 // the types being added in this CL. | 734 // the types being added in this CL. |
735 | 735 |
736 // TODO: enable this test when it works. | 736 test('throwsCyclicInitializationError', () { |
737 // See issue 12052. | |
738 skip_test('throwsCyclicInitializationError', () { | |
739 expect(() => new Bicycle(), throwsCyclicInitializationError); | 737 expect(() => new Bicycle(), throwsCyclicInitializationError); |
740 }); | 738 }); |
741 | 739 |
742 test('throwsAbstractClassInstantiationError', () { | 740 test('throwsAbstractClassInstantiationError', () { |
743 expect(() => new Abstraction(), throwsAbstractClassInstantiationError); | 741 expect(() => new Abstraction(), throwsAbstractClassInstantiationError); |
744 }); | 742 }); |
745 | 743 |
746 test('throwsConcurrentModificationError', () { | 744 test('throwsConcurrentModificationError', () { |
747 expect(() { | 745 expect(() { |
748 var a = { 'foo': 'bar' }; | 746 var a = { 'foo': 'bar' }; |
749 for (var k in a.keys) { | 747 for (var k in a.keys) { |
750 a.remove(k); | 748 a.remove(k); |
751 } | 749 } |
752 }, throwsConcurrentModificationError); | 750 }, throwsConcurrentModificationError); |
753 }); | 751 }); |
754 | 752 |
755 test('throwsNullThrownError', () { | 753 test('throwsNullThrownError', () { |
756 expect(() => throw null, throwsNullThrownError); | 754 expect(() => throw null, throwsNullThrownError); |
757 }); | 755 }); |
758 | 756 |
759 test('throwsFallThroughError', () { | 757 test('throwsFallThroughError', () { |
760 expect(() { | 758 expect(() { |
761 var a = 0; | 759 var a = 0; |
762 switch (a) { | 760 switch (a) { |
763 case 0: | 761 case 0: |
764 a += 1; | 762 a += 1; |
763 break; | |
Siggi Cherem (dart-lang)
2014/01/10 23:23:32
I think the idea of this test was to purposely lea
kevmoo
2014/01/10 23:37:45
Done.
| |
765 case 1: | 764 case 1: |
766 return; | 765 return; |
767 } | 766 } |
768 }, throwsFallThroughError); | 767 }, throwsFallThroughError); |
769 }); | 768 }); |
770 }); | 769 }); |
771 } | 770 } |
772 | 771 |
773 class Bicycle { | 772 class Bicycle { |
774 static var foo = bar(); | 773 static var foo = bar(); |
775 | 774 |
776 static bar() { | 775 static bar() { |
777 return foo + 1; | 776 return foo + 1; |
778 } | 777 } |
779 | 778 |
780 X() { | 779 X() { |
781 print(foo); | 780 print(foo); |
782 } | 781 } |
783 } | 782 } |
784 | 783 |
785 abstract class Abstraction { | 784 abstract class Abstraction { |
786 void norealization(); | 785 void norealization(); |
787 } | 786 } |
788 | 787 |
OLD | NEW |