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

Side by Side 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: More tests and allow type as an indentifier Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --harmony-types
6
7
8 load("test/mjsunit/harmony/typesystem/typegen.js");
9
10
11 // In all the following functions, the size parameter (positive integer)
12 // denotes how many test cases will be tried. The variable test_size
13 // controls execution time of this test. It should not be too high.
14 let test_size = 1000;
15
16
17 function ValidTypeAliases(size) {
18 return Generate(size, [
19 new TestGen(1, ValidTypes, [
20 t => "type T = " + t,
21 t => "type T<A> = " + t,
22 t => "type T<A, B> = " + t,
23 t => "type T<A extends {x: number}, B> = " + t
24 ])
25 ]);
26 }
27
28 function InvalidTypeAliases(size) {
29 return Generate(size, [
30 new TestGen(1, InvalidTypes, [
31 t => "type T = " + t,
32 t => "type T<A> = " + t,
33 t => "type T<A, B> = " + t,
34 t => "type T<A extends {x: number}, B> = " + t
35 ]),
36 "type T<> = number",
37 "type T",
38 "type T ="
39 ]);
40 }
41
42 (function TestTypeAliases(size) {
43 Test(size, [
44 new TestGen(3, ValidTypeAliases, [CheckValid]),
45 new TestGen(1, InvalidTypeAliases, [CheckInvalid]),
46 ]);
47 CheckValid("var type; type");
48 CheckValid("var type, number=10; type = number+1");
49 CheckValid("function type() {}; type(1, 2, 3)");
50 CheckValid("var type; type\n42");
51 })(test_size);
OLDNEW
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698