Skip to content

Commit 63ac3cd

Browse files
author
Yui T
committed
All tests for using let
1 parent 9ffa3cd commit 63ac3cd

48 files changed

Lines changed: 718 additions & 61 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts(5,13): error TS1005: '=' expected.
2+
tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts(5,20): error TS1005: ',' expected.
3+
tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts(7,1): error TS1005: ';' expected.
4+
5+
6+
==== tests/cases/compiler/invalidLetInForOfAndForIn_ES5.ts (3 errors) ====
7+
// This should be an error
8+
// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements
9+
10+
var let = 10;
11+
for (let of [1,2,3]) {}
12+
~
13+
!!! error TS1005: '=' expected.
14+
~
15+
!!! error TS1005: ',' expected.
16+
17+
for (let in [1,2,3]) {}
18+
~~~
19+
!!! error TS1005: ';' expected.
20+
21+
22+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//// [invalidLetInForOfAndForIn_ES5.ts]
2+
// This should be an error
3+
// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements
4+
5+
var let = 10;
6+
for (let of [1,2,3]) {}
7+
8+
for (let in [1,2,3]) {}
9+
10+
11+
12+
13+
//// [invalidLetInForOfAndForIn_ES5.js]
14+
// This should be an error
15+
// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements
16+
var let = 10;
17+
for (let of = [1, 2, 3], { }; ; )
18+
for ( in [1, 2, 3]) { }
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts(5,13): error TS1005: '=' expected.
2+
tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts(5,20): error TS1005: ',' expected.
3+
tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts(7,1): error TS1005: ';' expected.
4+
5+
6+
==== tests/cases/compiler/invalidLetInForOfAndForIn_ES6.ts (3 errors) ====
7+
// This should be an error
8+
// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements
9+
10+
var let = 10;
11+
for (let of [1,2,3]) {}
12+
~
13+
!!! error TS1005: '=' expected.
14+
~
15+
!!! error TS1005: ',' expected.
16+
17+
for (let in [1,2,3]) {}
18+
~~~
19+
!!! error TS1005: ';' expected.
20+
21+
22+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//// [invalidLetInForOfAndForIn_ES6.ts]
2+
// This should be an error
3+
// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements
4+
5+
var let = 10;
6+
for (let of [1,2,3]) {}
7+
8+
for (let in [1,2,3]) {}
9+
10+
11+
12+
13+
//// [invalidLetInForOfAndForIn_ES6.js]
14+
// This should be an error
15+
// More details: http://www.ecma-international.org/ecma-262/6.0/#sec-iteration-statements
16+
var let = 10;
17+
for (let of = [1, 2, 3], { }; ; )
18+
for ( in [1, 2, 3]) { }
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//// [letAsIdentifier2.ts]
2+
3+
function let() {}
4+
5+
//// [letAsIdentifier2.js]
6+
function let() { }
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
=== tests/cases/compiler/letAsIdentifier2.ts ===
2+
3+
function let() {}
4+
>let : Symbol(let, Decl(letAsIdentifier2.ts, 0, 0))
5+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
=== tests/cases/compiler/letAsIdentifier2.ts ===
2+
3+
function let() {}
4+
>let : () => void
5+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
tests/cases/compiler/letInConstDeclarations_ES5.ts(3,15): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
2+
tests/cases/compiler/letInConstDeclarations_ES5.ts(6,19): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
3+
4+
5+
==== tests/cases/compiler/letInConstDeclarations_ES5.ts (2 errors) ====
6+
7+
// All use of let in const declaration should be an error
8+
const x = 50, let = 5;
9+
~~~
10+
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
11+
12+
{
13+
const x = 10, let = 20;
14+
~~~
15+
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//// [letInConstDeclarations_ES5.ts]
2+
3+
// All use of let in const declaration should be an error
4+
const x = 50, let = 5;
5+
6+
{
7+
const x = 10, let = 20;
8+
}
9+
10+
//// [letInConstDeclarations_ES5.js]
11+
// All use of let in const declaration should be an error
12+
var x = 50, let = 5;
13+
{
14+
var x_1 = 10, let_1 = 20;
15+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
tests/cases/compiler/letInConstDeclarations_ES6.ts(3,15): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
2+
tests/cases/compiler/letInConstDeclarations_ES6.ts(6,19): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
3+
4+
5+
==== tests/cases/compiler/letInConstDeclarations_ES6.ts (2 errors) ====
6+
7+
// All use of let in const declaration should be an error
8+
const x = 50, let = 5;
9+
~~~
10+
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
11+
12+
{
13+
const x = 10, let = 20;
14+
~~~
15+
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
16+
}

0 commit comments

Comments
 (0)