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

Unified Diff: tests/language/typedef_is_test.dart

Issue 12087052: Implement Types.isSubtype for FunctionType with optional and named parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased (again) Created 7 years, 11 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/compiler/dart2js/type_checker_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/typedef_is_test.dart
diff --git a/tests/language/typedef_is_test.dart b/tests/language/typedef_is_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..56c6d37589f9ac704ae7d1ed233e9f8c58dcbb39
--- /dev/null
+++ b/tests/language/typedef_is_test.dart
@@ -0,0 +1,123 @@
+// Copyright (c) 2012, 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.
+
+// Test is-test of typedefs with optional and named parameters.
+
+typedef int Func1(int a);
+typedef int Func2(int a, [int b]);
+typedef int Func3(int a, [int b, int c]);
+typedef int Func4([int a, int b, int c]);
+typedef int Func5(int a, {int b});
+typedef int Func6(int a, {int b, int c});
+typedef int Func7({int a, int b, int c});
+
+void main() {
+ int func1(int i) {}
+ Expect.isTrue(func1 is Func1);
+ Expect.isFalse(func1 is Func2);
+ Expect.isFalse(func1 is Func3);
+ Expect.isFalse(func1 is Func4);
+ Expect.isFalse(func1 is Func5);
+ Expect.isFalse(func1 is Func6);
+ Expect.isFalse(func1 is Func7);
+
+ int func2(int i, int j) {}
+ Expect.isFalse(func2 is Func1);
+ Expect.isFalse(func2 is Func2);
+ Expect.isFalse(func2 is Func3);
+ Expect.isFalse(func2 is Func4);
+ Expect.isFalse(func2 is Func5);
+ Expect.isFalse(func2 is Func6);
+ Expect.isFalse(func2 is Func7);
+
+ int func3(int i, int j, int k) {}
+ Expect.isFalse(func3 is Func1);
+ Expect.isFalse(func3 is Func2);
+ Expect.isFalse(func3 is Func3);
+ Expect.isFalse(func3 is Func4);
+ Expect.isFalse(func3 is Func5);
+ Expect.isFalse(func3 is Func6);
+ Expect.isFalse(func3 is Func7);
+
+ int func4(int i, [int j]) {}
+ Expect.isTrue(func4 is Func1);
+ Expect.isTrue(func4 is Func2);
+ Expect.isFalse(func4 is Func3);
+ Expect.isFalse(func4 is Func4);
+ Expect.isFalse(func4 is Func5);
+ Expect.isFalse(func4 is Func6);
+ Expect.isFalse(func4 is Func7);
+
+ int func5(int i, [int j, int k]) {}
+ Expect.isTrue(func5 is Func1);
+ Expect.isTrue(func5 is Func2);
+ Expect.isTrue(func5 is Func3);
+ Expect.isFalse(func5 is Func4);
+ Expect.isFalse(func5 is Func5);
+ Expect.isFalse(func5 is Func6);
+ Expect.isFalse(func5 is Func7);
+
+ int func6([int i, int j, int k]) {}
+ Expect.isFalse(func6 is Func1);
+ Expect.isFalse(func6 is Func2);
+ Expect.isFalse(func6 is Func3);
+ Expect.isTrue(func6 is Func4);
+ Expect.isFalse(func6 is Func5);
+ Expect.isFalse(func6 is Func6);
+ Expect.isFalse(func6 is Func7);
+
+ int func7(int i, {int j}) {}
+ Expect.isTrue(func7 is Func1);
+ Expect.isFalse(func7 is Func2);
+ Expect.isFalse(func7 is Func3);
+ Expect.isFalse(func7 is Func4);
+ Expect.isFalse(func7 is Func5);
+ Expect.isFalse(func7 is Func6);
+ Expect.isFalse(func7 is Func7);
+
+ int func8(int i, {int b}) {}
+ Expect.isTrue(func8 is Func1);
+ Expect.isFalse(func8 is Func2);
+ Expect.isFalse(func8 is Func3);
+ Expect.isFalse(func8 is Func4);
+ Expect.isTrue(func8 is Func5);
+ Expect.isFalse(func8 is Func6);
+ Expect.isFalse(func8 is Func7);
+
+ int func9(int i, {int b, int c}) {}
+ Expect.isTrue(func9 is Func1);
+ Expect.isFalse(func9 is Func2);
+ Expect.isFalse(func9 is Func3);
+ Expect.isFalse(func9 is Func4);
+ Expect.isTrue(func9 is Func5);
+ Expect.isTrue(func9 is Func6);
+ Expect.isFalse(func9 is Func7);
+
+ int func10(int i, {int c, int b}) {}
+ Expect.isTrue(func10 is Func1);
+ Expect.isFalse(func10 is Func2);
+ Expect.isFalse(func10 is Func3);
+ Expect.isFalse(func10 is Func4);
+ Expect.isTrue(func10 is Func5);
+ Expect.isTrue(func10 is Func6);
+ Expect.isFalse(func10 is Func7);
+
+ int func11({int a, int b, int c}) {}
+ Expect.isFalse(func11 is Func1);
+ Expect.isFalse(func11 is Func2);
+ Expect.isFalse(func11 is Func3);
+ Expect.isFalse(func11 is Func4);
+ Expect.isFalse(func11 is Func5);
+ Expect.isFalse(func11 is Func6);
+ Expect.isTrue(func11 is Func7);
+
+ int func12({int c, int a, int b}) {}
+ Expect.isFalse(func12 is Func1);
+ Expect.isFalse(func12 is Func2);
+ Expect.isFalse(func12 is Func3);
+ Expect.isFalse(func12 is Func4);
+ Expect.isFalse(func12 is Func5);
+ Expect.isFalse(func12 is Func6);
+ Expect.isTrue(func12 is Func7);
+}
« no previous file with comments | « tests/compiler/dart2js/type_checker_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698