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

Unified Diff: test/mjsunit/harmony/typesystem/type-parameters.js

Issue 1817353003: Add tests for variable declarations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@types
Patch Set: Created 4 years, 9 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 | « test/mjsunit/harmony/typesystem/tuple-types.js ('k') | test/mjsunit/harmony/typesystem/type-query.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/typesystem/type-parameters.js
diff --git a/test/mjsunit/harmony/typesystem/type-parameters.js b/test/mjsunit/harmony/typesystem/type-parameters.js
index a62b26f71dd052d165b76d1d1dc9441d11d468c6..83351d7cf84e0f9d5d98e8f3c3eaedf48fceb8b4 100644
--- a/test/mjsunit/harmony/typesystem/type-parameters.js
+++ b/test/mjsunit/harmony/typesystem/type-parameters.js
@@ -4,37 +4,31 @@
// Flags: --harmony-types
-function CheckValid(type) {
- // print("V:", type);
- assertDoesNotThrow("'use types'; var x: " + type + ";");
-}
-function CheckInvalid(type) {
- // print("I:", type);
- assertThrows("'use types'; var x: " + type + ";", SyntaxError);
-}
+load("test/mjsunit/harmony/typesystem/testgen.js");
+
(function TestParametricFunctionTypes() {
- CheckValid("<A> (x: A) => A");
- CheckValid("<A extends string> (x: A) => A");
- CheckValid("<A, B> (x: A, y: B) => A");
- CheckValid("<A, B extends number[], C> (x: A, y: B) => C");
- CheckValid("<A, B, C, D> (x: A, y: B, z: C[], d: (e: D) => D) => A");
+ CheckValidType("<A> (x: A) => A");
+ CheckValidType("<A extends string> (x: A) => A");
+ CheckValidType("<A, B> (x: A, y: B) => A");
+ CheckValidType("<A, B extends number[], C> (x: A, y: B) => C");
+ CheckValidType("<A, B, C, D> (x: A, y: B, z: C[], d: (e: D) => D) => A");
// Type parameter lists in non-function types.
- CheckInvalid("<A> A[]");
+ CheckInvalidType("<A> A[]");
// Empty type parameter list is disallowed.
- CheckInvalid("<> (x: number) => number");
+ CheckInvalidType("<> (x: number) => number");
// Invalid type in extends.
- CheckInvalid("<A extends ()> (x: A) => A");
+ CheckInvalidType("<A extends ()> (x: A) => A");
})();
(function TestParametricTypeReferences() {
- CheckValid("Tree<number>");
- CheckValid("Map<string, number>");
+ CheckValidType("Tree<number>");
+ CheckValidType("Map<string, number>");
// Invalid types as arguments.
- CheckInvalid("Map<string, (number, void)>");
+ CheckInvalidType("Map<string, (number, void)>");
// Type arguments not in type references.
- CheckInvalid("number<string>");
+ CheckInvalidType("number<string>");
// Empty type argument list is disallowed.
- CheckInvalid("Foo<>");
+ CheckInvalidType("Foo<>");
})();
« no previous file with comments | « test/mjsunit/harmony/typesystem/tuple-types.js ('k') | test/mjsunit/harmony/typesystem/type-query.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698