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

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

Issue 1839393002: Add parsing for type aliases (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@types-1841093002-fun-decl
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
« test/cctest/test-parsing.cc ('K') | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/typesystem/type-aliases.js
diff --git a/test/mjsunit/harmony/typesystem/type-aliases.js b/test/mjsunit/harmony/typesystem/type-aliases.js
new file mode 100644
index 0000000000000000000000000000000000000000..847b235a833cb7bf8ef698bf1b190ac03149717e
--- /dev/null
+++ b/test/mjsunit/harmony/typesystem/type-aliases.js
@@ -0,0 +1,47 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-types
+
+
+load("test/mjsunit/harmony/typesystem/typegen.js");
+
+
+// In all the following functions, the size parameter (positive integer)
+// denotes how many test cases will be tried. The variable test_size
+// controls execution time of this test. It should not be too high.
+let test_size = 1000;
+
+
+function ValidTypeAliases(size) {
+ return Generate(size, [
+ new TestGen(1, ValidTypes, [
+ t => "type T = " + t,
+ t => "type T<A> = " + t,
+ t => "type T<A, B> = " + t,
+ t => "type T<A extends {x: number}, B> = " + t
+ ])
+ ]);
+}
+
+function InvalidTypeAliases(size) {
+ return Generate(size, [
+ new TestGen(1, InvalidTypes, [
+ t => "type T = " + t,
+ t => "type T<A> = " + t,
+ t => "type T<A, B> = " + t,
+ t => "type T<A extends {x: number}, B> = " + t
+ ]),
+ "type T<> = number",
+ "type T",
+ "type T ="
+ ]);
+}
+
+(function TestTypeAliases(size) {
+ Test(size, [
+ new TestGen(3, ValidTypeAliases, [CheckValid]),
+ new TestGen(1, InvalidTypeAliases, [CheckInvalid]),
+ ]);
+})(test_size);
« test/cctest/test-parsing.cc ('K') | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698