Add some negative test cases and accept baselines

This commit is contained in:
Andrew Branch 2019-06-26 14:01:50 -07:00
parent aaf818b4eb
commit 5ff3cda078
No known key found for this signature in database
GPG Key ID: 22CCA4B120C427D2
10 changed files with 178 additions and 3 deletions

View File

@ -0,0 +1,13 @@
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'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES5.ts (1 errors) ====
var v = {
[-1]: {},
[+1]: {},
[~1]: {},
[!1]: {}
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
}

View File

@ -0,0 +1,25 @@
//// [computedPropertyNamesDeclarationEmit6_ES5.ts]
var v = {
[-1]: {},
[+1]: {},
[~1]: {},
[!1]: {}
}
//// [computedPropertyNamesDeclarationEmit6_ES5.js]
var _a;
var v = (_a = {},
_a[-1] = {},
_a[+1] = {},
_a[~1] = {},
_a[!1] = {},
_a);
//// [computedPropertyNamesDeclarationEmit6_ES5.d.ts]
declare var v: {
[x: number]: {};
[-1]: {};
1: {};
};

View File

@ -0,0 +1,17 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES5.ts ===
var v = {
>v : Symbol(v, Decl(computedPropertyNamesDeclarationEmit6_ES5.ts, 0, 3))
[-1]: {},
>[-1] : Symbol([-1], Decl(computedPropertyNamesDeclarationEmit6_ES5.ts, 0, 9))
[+1]: {},
>[+1] : Symbol([+1], Decl(computedPropertyNamesDeclarationEmit6_ES5.ts, 1, 11))
[~1]: {},
>[~1] : Symbol([~1], Decl(computedPropertyNamesDeclarationEmit6_ES5.ts, 2, 11))
[!1]: {}
>[!1] : Symbol([!1], Decl(computedPropertyNamesDeclarationEmit6_ES5.ts, 3, 11))
}

View File

@ -0,0 +1,30 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES5.ts ===
var v = {
>v : { [x: number]: {}; [-1]: {}; 1: {}; }
>{ [-1]: {}, [+1]: {}, [~1]: {}, [!1]: {}} : { [x: number]: {}; [-1]: {}; [+1]: {}; }
[-1]: {},
>[-1] : {}
>-1 : -1
>1 : 1
>{} : {}
[+1]: {},
>[+1] : {}
>+1 : 1
>1 : 1
>{} : {}
[~1]: {},
>[~1] : {}
>~1 : number
>1 : 1
>{} : {}
[!1]: {}
>[!1] : {}
>!1 : boolean
>1 : 1
>{} : {}
}

View File

@ -0,0 +1,13 @@
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'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES6.ts (1 errors) ====
var v = {
[-1]: {},
[+1]: {},
[~1]: {},
[!1]: {}
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
}

View File

@ -0,0 +1,24 @@
//// [computedPropertyNamesDeclarationEmit6_ES6.ts]
var v = {
[-1]: {},
[+1]: {},
[~1]: {},
[!1]: {}
}
//// [computedPropertyNamesDeclarationEmit6_ES6.js]
var v = {
[-1]: {},
[+1]: {},
[~1]: {},
[!1]: {}
};
//// [computedPropertyNamesDeclarationEmit6_ES6.d.ts]
declare var v: {
[x: number]: {};
[-1]: {};
1: {};
};

View File

@ -0,0 +1,17 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES6.ts ===
var v = {
>v : Symbol(v, Decl(computedPropertyNamesDeclarationEmit6_ES6.ts, 0, 3))
[-1]: {},
>[-1] : Symbol([-1], Decl(computedPropertyNamesDeclarationEmit6_ES6.ts, 0, 9))
[+1]: {},
>[+1] : Symbol([+1], Decl(computedPropertyNamesDeclarationEmit6_ES6.ts, 1, 11))
[~1]: {},
>[~1] : Symbol([~1], Decl(computedPropertyNamesDeclarationEmit6_ES6.ts, 2, 11))
[!1]: {}
>[!1] : Symbol([!1], Decl(computedPropertyNamesDeclarationEmit6_ES6.ts, 3, 11))
}

View File

@ -0,0 +1,30 @@
=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit6_ES6.ts ===
var v = {
>v : { [x: number]: {}; [-1]: {}; 1: {}; }
>{ [-1]: {}, [+1]: {}, [~1]: {}, [!1]: {}} : { [x: number]: {}; [-1]: {}; [+1]: {}; }
[-1]: {},
>[-1] : {}
>-1 : -1
>1 : 1
>{} : {}
[+1]: {},
>[+1] : {}
>+1 : 1
>1 : 1
>{} : {}
[~1]: {},
>[~1] : {}
>~1 : number
>1 : 1
>{} : {}
[!1]: {}
>[!1] : {}
>!1 : boolean
>1 : 1
>{} : {}
}

View File

@ -1,5 +1,8 @@
// @target: es5
// @declaration: true
var v = {
[-1]: {}
[-1]: {},
[+1]: {},
[~1]: {},
[!1]: {}
}

View File

@ -1,5 +1,8 @@
// @target: es6
// @declaration: true
var v = {
[-1]: {}
}
[-1]: {},
[+1]: {},
[~1]: {},
[!1]: {}
}