mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
Merge pull request #7165 from Microsoft/add-tests-for-let
Add tests for let declarations/identifier variables
This commit is contained in:
7
tests/baselines/reference/VariableDeclaration12_es6.js
Normal file
7
tests/baselines/reference/VariableDeclaration12_es6.js
Normal file
@@ -0,0 +1,7 @@
|
||||
//// [VariableDeclaration12_es6.ts]
|
||||
|
||||
let
|
||||
x
|
||||
|
||||
//// [VariableDeclaration12_es6.js]
|
||||
let x;
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts ===
|
||||
|
||||
let
|
||||
x
|
||||
>x : Symbol(x, Decl(VariableDeclaration12_es6.ts, 1, 3))
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts ===
|
||||
|
||||
let
|
||||
x
|
||||
>x : any
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,5): error TS1181: Array element destructuring pattern expected.
|
||||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,6): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,8): error TS1134: Variable declaration expected.
|
||||
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,10): error TS1134: Variable declaration expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts (4 errors) ====
|
||||
|
||||
// An ExpressionStatement cannot start with the two token sequence `let [` because
|
||||
// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern.
|
||||
var let: any;
|
||||
let[0] = 100;
|
||||
~
|
||||
!!! error TS1181: Array element destructuring pattern expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
~~~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
13
tests/baselines/reference/VariableDeclaration13_es6.js
Normal file
13
tests/baselines/reference/VariableDeclaration13_es6.js
Normal file
@@ -0,0 +1,13 @@
|
||||
//// [VariableDeclaration13_es6.ts]
|
||||
|
||||
// An ExpressionStatement cannot start with the two token sequence `let [` because
|
||||
// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern.
|
||||
var let: any;
|
||||
let[0] = 100;
|
||||
|
||||
//// [VariableDeclaration13_es6.js]
|
||||
// An ExpressionStatement cannot start with the two token sequence `let [` because
|
||||
// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern.
|
||||
var let;
|
||||
let [] = 0;
|
||||
100;
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [letIdentifierInElementAccess01.ts]
|
||||
var let: any = {};
|
||||
(let[0] = 100);
|
||||
|
||||
//// [letIdentifierInElementAccess01.js]
|
||||
var let = {};
|
||||
(let[0] = 100);
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts ===
|
||||
var let: any = {};
|
||||
>let : Symbol(let, Decl(letIdentifierInElementAccess01.ts, 0, 3))
|
||||
|
||||
(let[0] = 100);
|
||||
>let : Symbol(let, Decl(letIdentifierInElementAccess01.ts, 0, 3))
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts ===
|
||||
var let: any = {};
|
||||
>let : any
|
||||
>{} : {}
|
||||
|
||||
(let[0] = 100);
|
||||
>(let[0] = 100) : number
|
||||
>let[0] = 100 : number
|
||||
>let[0] : any
|
||||
>let : any
|
||||
>0 : number
|
||||
>100 : number
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// @target:es6
|
||||
|
||||
let
|
||||
x
|
||||
@@ -0,0 +1,6 @@
|
||||
// @target:es6
|
||||
|
||||
// An ExpressionStatement cannot start with the two token sequence `let [` because
|
||||
// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern.
|
||||
var let: any;
|
||||
let[0] = 100;
|
||||
@@ -0,0 +1,2 @@
|
||||
var let: any = {};
|
||||
(let[0] = 100);
|
||||
Reference in New Issue
Block a user