Index: tests/language/black_listed_test.dart |
diff --git a/tests/language/black_listed_test.dart b/tests/language/black_listed_test.dart |
index a575375b86a94bedd66b266af2f57b6ed3d8155c..fc94444ee18119c945aeadb93b6f8d3826a8a3e9 100644 |
--- a/tests/language/black_listed_test.dart |
+++ b/tests/language/black_listed_test.dart |
@@ -3,77 +3,135 @@ |
// BSD-style license that can be found in the LICENSE file. |
// Dart test checking that static/instance field shadowing do not conflict. |
+import 'package:expect/expect.dart' show Expect; |
+ |
// Test that certain interfaces/classes are blacklisted from being |
// implemented or extended. |
-// bool. |
-class MyBool implements bool {} // //# 01: compile-time error |
-abstract class MyBoolInterface implements bool default F { // //# 02: compile-time error |
- MyBoolInterface(); // //# 02: continued |
-} // //# 02: continued |
- |
-// num. |
-class MyNum implements num {} // //# 03: compile-time error |
-abstract class MyNumInterface implements num default F { // //# 04: compile-time error |
- MyNumInterface(); // //# 04: continued |
-} // //# 04: continued |
- |
-// int. |
-class MyInt implements int {} // //# 05: compile-time error |
-abstract class MyIntInterface implements int default F { // //# 06: compile-time error |
- MyIntInterface(); // //# 06: continued |
-} // //# 06: continued |
- |
-// double. |
-class MyDouble implements double {} // //# 07: compile-time error |
-abstract class MyDoubleInterface implements double default F { // //# 08: compile-time error |
- MyDoubleInterface(); // //# 08: continued |
-} // //# 08: continued |
- |
-// String. |
-class MyString implements String {} // //# 09: compile-time error |
-abstract class MyStringInterface implements String default F { // //# 10: compile-time error |
- MyStringInterface(); // //# 10: continued |
-} // //# 10: continued |
- |
-// Function. |
-class MyFunction implements Function {} |
- |
-class MyOtherFunction extends Function {} |
-abstract class MyFunctionInterface implements Function default F { // //# 12: compile-time error |
- MyFunctionInterface(); // //# 12: continued |
-} // //# 12: continued |
- |
-// dynamic. |
-class MyDynamic implements dynamic {} // //# 13: compile-time error |
-abstract class MyDynamicInterface implements dynamic default F { // //# 14: compile-time error |
- MyDynamicInterface(); // //# 14: continued |
-} // //# 14: continued |
- |
-class F { |
- factory MyBoolInterface() { return null; } // //# 02: continued |
- factory MyNumInterface() { return null; } // //# 04: continued |
- factory MyIntInterface() { return null; } // //# 06: continued |
- factory MyDoubleInterface() { return null; } // //# 08: continued |
- factory MyStringInterface() { return null; } // //# 10: continued |
- factory MyFunctionInterface() { return null; } // //# 12: continued |
- factory MyDynamicInterface() { return null; } // //# 14: continued |
+class MyBool |
+ extends bool //# 01a: compile-time error |
+ implements bool //# 01b: compile-time error |
+ extends Object with bool //# 01c: compile-time error |
+{ |
+ factory MyBool() => throw "bad"; |
+} |
+ |
+abstract class MyBoolInterface |
+ extends bool //# 02a: compile-time error |
+ implements bool //# 02b: compile-time error |
+ extends Object with bool //# 02c: compile-time error |
+{ |
+ factory MyBoolInterface() => throw "bad"; |
+} |
+ |
+class MyNum |
+ extends num //# 03a: compile-time error |
+ implements num //# 03b: compile-time error |
+ extends Object with num //# 03c: compile-time error |
+{ |
+ factory MyNum() => throw "bad"; |
+} |
+ |
+abstract class MyNumInterface |
+ extends num //# 04a: compile-time error |
+ implements num //# 04b: compile-time error |
+ extends Object with num //# 04c: compile-time error |
+{ |
+ factory MyNumInterface() => throw "bad"; |
+} |
+ |
+class MyInt |
+ extends int //# 05a: compile-time error |
+ implements int //# 05b: compile-time error |
+ extends Object with int //# 05c: compile-time error |
+{ |
+ factory MyInt() => throw "bad"; |
+} |
+ |
+abstract class MyIntInterface |
+ extends int //# 06a: compile-time error |
+ implements int //# 06b: compile-time error |
+ extends Object with int //# 06c: compile-time error |
+{ |
+ factory MyIntInterface() => throw "bad"; |
+} |
+ |
+class MyDouble |
+ extends double //# 07a: compile-time error |
+ implements double //# 07b: compile-time error |
+ extends Object with double //# 07c: compile-time error |
+{ |
+ factory MyDouble() => throw "bad"; |
+} |
+ |
+abstract class MyDoubleInterface |
+ extends double //# 08a: compile-time error |
+ implements double //# 08b: compile-time error |
+ extends Object with double //# 08c: compile-time error |
+{ |
+ factory MyDoubleInterface() => throw "bad"; |
} |
+class MyString |
+ extends String //# 09a: compile-time error |
+ implements String //# 09b: compile-time error |
+ extends Object with String //# 09c: compile-time error |
+{ |
+ factory MyString() => throw "bad"; |
+} |
+ |
+abstract class MyStringInterface |
+ extends String //# 10a: compile-time error |
+ implements String //# 10b: compile-time error |
+ extends Object with String //# 10c: compile-time error |
+{ |
+ factory MyStringInterface() => throw "bad"; |
+} |
+ |
+class MyFunction implements Function { |
+ factory MyFunction() => throw "bad"; |
+} |
+ |
+class MyOtherFunction extends Function { |
+ factory MyOtherFunction() => throw "bad"; |
+} |
+ |
+abstract class MyFunctionInterface implements Function { |
+ factory MyFunctionInterface() => throw "bad"; |
+} |
+ |
+class MyDynamic |
+ extends dynamic //# 13a: compile-time error |
+ implements dynamic //# 13b: compile-time error |
+ extends Object with dynamic //# 13c: compile-time error |
+{ |
+ factory MyDynamic() => throw "bad"; |
+} |
+ |
+abstract class MyDynamicInterface |
+ extends dynamic //# 14a: compile-time error |
+ implements dynamic //# 14b: compile-time error |
+ extends Object with dynamic //# 14c: compile-time error |
+{ |
+ factory MyDynamicInterface() => throw "bad"; |
+} |
+ |
+bool isBadString(e) => identical("bad", e); |
+ |
main() { |
- new MyBool(); // //# 01: continued |
- new MyBoolInterface(); // //# 02: continued |
- new MyNum(); // //# 03: continued |
- new MyNumInterface(); // //# 04: continued |
- new MyInt(); // //# 05: continued |
- new MyIntInterface(); // //# 06: continued |
- new MyDouble(); // //# 07: continued |
- new MyDoubleInterface(); // //# 08: continued |
- new MyString(); // //# 09: continued |
- new MyStringInterface(); // //# 10: continued |
- new MyFunction(); |
- new MyOtherFunction(); |
- new MyFunctionInterface(); //# 12: continued |
- new MyDynamic(); // //# 13: continued |
- new MyDynamicInterface(); // //# 14: continued |
+ Expect.throws(() => new MyBool(), isBadString); |
+ Expect.throws(() => new MyBoolInterface(), isBadString); |
+ Expect.throws(() => new MyNum(), isBadString); |
+ Expect.throws(() => new MyNumInterface(), isBadString); |
+ Expect.throws(() => new MyInt(), isBadString); |
+ Expect.throws(() => new MyIntInterface(), isBadString); |
+ Expect.throws(() => new MyDouble(), isBadString); |
+ Expect.throws(() => new MyDoubleInterface(), isBadString); |
+ Expect.throws(() => new MyString(), isBadString); |
+ Expect.throws(() => new MyStringInterface(), isBadString); |
+ Expect.throws(() => new MyFunction(), isBadString); |
+ Expect.throws(() => new MyOtherFunction(), isBadString); |
+ Expect.throws(() => new MyFunctionInterface(), isBadString); |
+ Expect.throws(() => new MyDynamic(), isBadString); |
+ Expect.throws(() => new MyDynamicInterface(), isBadString); |
} |