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

Unified Diff: tests/language/function_subtype_simple2_test.dart

Issue 22903036: Use predicates to check simple function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 4 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 | « tests/language/function_subtype_simple1_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/function_subtype_simple2_test.dart
diff --git a/tests/language/function_subtype_simple2_test.dart b/tests/language/function_subtype_simple2_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..70f53f3392411521f7b518f946fa7b7479d66047
--- /dev/null
+++ b/tests/language/function_subtype_simple2_test.dart
@@ -0,0 +1,74 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Dart test program for constructors and initializers.
+
+// Check function subtyping of simple function types.
+
+import 'package:expect/expect.dart';
+
+typedef Args0();
+typedef Args1(a);
+typedef Args2(a, b);
+typedef Args3(a, b, c);
+typedef Args4(a, b, c, d);
+
+args0_1([a]) {}
+args1_2(a, [b]) {}
+args0_2([a, b]) {}
+args1_3(a, [b, c]) {}
+
+args0_1_named({a}) {}
+args1_2_named(a, {b}) {}
+args0_2_named({a, b}) {}
+args1_3_named(a, {b, c}) {}
+
+main() {
+ Expect.isTrue(args0_1 is Args0);
+ Expect.isTrue(args0_1 is Args1);
+ Expect.isFalse(args0_1 is Args2);
+ Expect.isFalse(args0_1 is Args3);
+ Expect.isFalse(args0_1 is Args4);
+
+ Expect.isFalse(args1_2 is Args0);
+ Expect.isTrue(args1_2 is Args1);
+ Expect.isTrue(args1_2 is Args2);
+ Expect.isFalse(args1_2 is Args3);
+ Expect.isFalse(args1_2 is Args4);
+
+ Expect.isTrue(args0_2 is Args0);
+ Expect.isTrue(args0_2 is Args1);
+ Expect.isTrue(args0_2 is Args2);
+ Expect.isFalse(args0_2 is Args3);
+ Expect.isFalse(args0_2 is Args4);
+
+ Expect.isFalse(args1_3 is Args0);
+ Expect.isTrue(args1_3 is Args1);
+ Expect.isTrue(args1_3 is Args2);
+ Expect.isTrue(args1_3 is Args3);
+ Expect.isFalse(args1_3 is Args4);
+
+ Expect.isTrue(args0_1_named is Args0);
+ Expect.isFalse(args0_1_named is Args1);
+ Expect.isFalse(args0_1_named is Args2);
+ Expect.isFalse(args0_1_named is Args3);
+ Expect.isFalse(args0_1_named is Args4);
+
+ Expect.isFalse(args1_2_named is Args0);
+ Expect.isTrue(args1_2_named is Args1);
+ Expect.isFalse(args1_2_named is Args2);
+ Expect.isFalse(args1_2_named is Args3);
+ Expect.isFalse(args1_2_named is Args4);
+
+ Expect.isTrue(args0_2_named is Args0);
+ Expect.isFalse(args0_2_named is Args1);
+ Expect.isFalse(args0_2_named is Args2);
+ Expect.isFalse(args0_2_named is Args3);
+ Expect.isFalse(args0_2_named is Args4);
+
+ Expect.isFalse(args1_3_named is Args0);
+ Expect.isTrue(args1_3_named is Args1);
+ Expect.isFalse(args1_3_named is Args2);
+ Expect.isFalse(args1_3_named is Args3);
+ Expect.isFalse(args1_3_named is Args4);
+}
« no previous file with comments | « tests/language/function_subtype_simple1_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698