Skip to content

Commit 5ff3cda

Browse files
committed
Add some negative test cases and accept baselines
1 parent aaf818b commit 5ff3cda

10 files changed

+178
-3
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES5.ts(5,3): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
2+
3+
4+
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES5.ts (1 errors) ====
5+
var v = {
6+
[-1]: {},
7+
[+1]: {},
8+
[~1]: {},
9+
[!1]: {}
10+
~~~~
11+
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
12+
}
13+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//// [computedPropertyNamesDeclarationEmit6_ES5.ts]
2+
var v = {
3+
[-1]: {},
4+
[+1]: {},
5+
[~1]: {},
6+
[!1]: {}
7+
}
8+
9+
10+
//// [computedPropertyNamesDeclarationEmit6_ES5.js]
11+
var _a;
12+
var v = (_a = {},
13+
_a[-1] = {},
14+
_a[+1] = {},
15+
_a[~1] = {},
16+
_a[!1] = {},
17+
_a);
18+
19+
20+
//// [computedPropertyNamesDeclarationEmit6_ES5.d.ts]
21+
declare var v: {
22+
[x: number]: {};
23+
[-1]: {};
24+
1: {};
25+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES5.ts ===
2+
var v = {
3+
>v : Symbol(v, Decl(computedPropertyNamesDeclarationEmit6_ES5.ts, 0, 3))
4+
5+
[-1]: {},
6+
>[-1] : Symbol([-1], Decl(computedPropertyNamesDeclarationEmit6_ES5.ts, 0, 9))
7+
8+
[+1]: {},
9+
>[+1] : Symbol([+1], Decl(computedPropertyNamesDeclarationEmit6_ES5.ts, 1, 11))
10+
11+
[~1]: {},
12+
>[~1] : Symbol([~1], Decl(computedPropertyNamesDeclarationEmit6_ES5.ts, 2, 11))
13+
14+
[!1]: {}
15+
>[!1] : Symbol([!1], Decl(computedPropertyNamesDeclarationEmit6_ES5.ts, 3, 11))
16+
}
17+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES5.ts ===
2+
var v = {
3+
>v : { [x: number]: {}; [-1]: {}; 1: {}; }
4+
>{ [-1]: {}, [+1]: {}, [~1]: {}, [!1]: {}} : { [x: number]: {}; [-1]: {}; [+1]: {}; }
5+
6+
[-1]: {},
7+
>[-1] : {}
8+
>-1 : -1
9+
>1 : 1
10+
>{} : {}
11+
12+
[+1]: {},
13+
>[+1] : {}
14+
>+1 : 1
15+
>1 : 1
16+
>{} : {}
17+
18+
[~1]: {},
19+
>[~1] : {}
20+
>~1 : number
21+
>1 : 1
22+
>{} : {}
23+
24+
[!1]: {}
25+
>[!1] : {}
26+
>!1 : boolean
27+
>1 : 1
28+
>{} : {}
29+
}
30+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES6.ts(5,3): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
2+
3+
4+
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES6.ts (1 errors) ====
5+
var v = {
6+
[-1]: {},
7+
[+1]: {},
8+
[~1]: {},
9+
[!1]: {}
10+
~~~~
11+
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
12+
}
13+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//// [computedPropertyNamesDeclarationEmit6_ES6.ts]
2+
var v = {
3+
[-1]: {},
4+
[+1]: {},
5+
[~1]: {},
6+
[!1]: {}
7+
}
8+
9+
10+
//// [computedPropertyNamesDeclarationEmit6_ES6.js]
11+
var v = {
12+
[-1]: {},
13+
[+1]: {},
14+
[~1]: {},
15+
[!1]: {}
16+
};
17+
18+
19+
//// [computedPropertyNamesDeclarationEmit6_ES6.d.ts]
20+
declare var v: {
21+
[x: number]: {};
22+
[-1]: {};
23+
1: {};
24+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES6.ts ===
2+
var v = {
3+
>v : Symbol(v, Decl(computedPropertyNamesDeclarationEmit6_ES6.ts, 0, 3))
4+
5+
[-1]: {},
6+
>[-1] : Symbol([-1], Decl(computedPropertyNamesDeclarationEmit6_ES6.ts, 0, 9))
7+
8+
[+1]: {},
9+
>[+1] : Symbol([+1], Decl(computedPropertyNamesDeclarationEmit6_ES6.ts, 1, 11))
10+
11+
[~1]: {},
12+
>[~1] : Symbol([~1], Decl(computedPropertyNamesDeclarationEmit6_ES6.ts, 2, 11))
13+
14+
[!1]: {}
15+
>[!1] : Symbol([!1], Decl(computedPropertyNamesDeclarationEmit6_ES6.ts, 3, 11))
16+
}
17+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES6.ts ===
2+
var v = {
3+
>v : { [x: number]: {}; [-1]: {}; 1: {}; }
4+
>{ [-1]: {}, [+1]: {}, [~1]: {}, [!1]: {}} : { [x: number]: {}; [-1]: {}; [+1]: {}; }
5+
6+
[-1]: {},
7+
>[-1] : {}
8+
>-1 : -1
9+
>1 : 1
10+
>{} : {}
11+
12+
[+1]: {},
13+
>[+1] : {}
14+
>+1 : 1
15+
>1 : 1
16+
>{} : {}
17+
18+
[~1]: {},
19+
>[~1] : {}
20+
>~1 : number
21+
>1 : 1
22+
>{} : {}
23+
24+
[!1]: {}
25+
>[!1] : {}
26+
>!1 : boolean
27+
>1 : 1
28+
>{} : {}
29+
}
30+
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// @target: es5
22
// @declaration: true
33
var v = {
4-
[-1]: {}
4+
[-1]: {},
5+
[+1]: {},
6+
[~1]: {},
7+
[!1]: {}
58
}
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// @target: es6
22
// @declaration: true
33
var v = {
4-
[-1]: {}
5-
}
4+
[-1]: {},
5+
[+1]: {},
6+
[~1]: {},
7+
[!1]: {}
8+
}

0 commit comments

Comments
 (0)