Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: pkg/unittest/test/matchers_test.dart

Issue 20586002: Add matchers for some more recent error types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/unittest/lib/src/core_matchers.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/test/matchers_test.dart
===================================================================
--- pkg/unittest/test/matchers_test.dart (revision 25479)
+++ pkg/unittest/test/matchers_test.dart (working copy)
@@ -706,5 +706,61 @@
shouldPass('cow', predicate((x) => x is String, "an instance of String"));
});
});
+
+ group('exception/error matchers', () {
+ // TODO(gram): extend this to more types; for now this is just
+ // the types being added in this CL.
+
+ // TODO: enable this test when it works.
+ // See issue 12052.
+ skip_test('throwsCyclicInitializationError', () {
+ expect(() => new Bicycle(), throwsCyclicInitializationError);
+ });
+
+ test('throwsAbstractClassInstantiationError', () {
+ expect(() => new Abstraction(), throwsAbstractClassInstantiationError);
+ });
+
+ test('throwsConcurrentModificationError', () {
+ expect(() {
+ var a = { 'foo': 'bar' };
+ for (var k in a.keys) {
+ a.remove(k);
+ }
+ }, throwsConcurrentModificationError);
+ });
+
+ test('throwsNullThrownError', () {
+ expect(() => throw null, throwsNullThrownError);
+ });
+
+ test('throwsFallThroughError', () {
+ expect(() {
+ var a = 0;
+ switch (a) {
+ case 0:
+ a += 1;
+ case 1:
+ return;
+ }
+ }, throwsFallThroughError);
+ });
+ });
}
+class Bicycle {
+ static var foo = bar();
+
+ static bar() {
+ return foo + 1;
+ }
+
+ X() {
+ print(foo);
+ }
+}
+
+abstract class Abstraction {
+ void norealization();
+}
+
« no previous file with comments | « pkg/unittest/lib/src/core_matchers.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698