Add tests and Update baselines (#10616)

Update tests and baselines

Update tests and baselines

Update tests for downlevel emit

Add tests and update baselines

Add tests and baselines

Update baselines

Update baselines
This commit is contained in:
Yui
2016-09-01 13:57:52 -07:00
committed by GitHub
parent a370908421
commit f8d6e26d4d
12 changed files with 253 additions and 14 deletions

View File

@@ -1,5 +1,9 @@
//// [classExpressionWithStaticProperties1.ts]
var v = class C { static a = 1; static b = 2 };
var v = class C {
static a = 1;
static b = 2;
static c = C.a + C.b;
};
//// [classExpressionWithStaticProperties1.js]
var v = (_a = (function () {
@@ -9,5 +13,6 @@ var v = (_a = (function () {
}()),
_a.a = 1,
_a.b = 2,
_a.c = _a.a + _a.b,
_a);
var _a;

View File

@@ -1,7 +1,21 @@
=== tests/cases/compiler/classExpressionWithStaticProperties1.ts ===
var v = class C { static a = 1; static b = 2 };
var v = class C {
>v : Symbol(v, Decl(classExpressionWithStaticProperties1.ts, 0, 3))
>C : Symbol(C, Decl(classExpressionWithStaticProperties1.ts, 0, 7))
>a : Symbol(C.a, Decl(classExpressionWithStaticProperties1.ts, 0, 17))
>b : Symbol(C.b, Decl(classExpressionWithStaticProperties1.ts, 0, 31))
static a = 1;
>a : Symbol(C.a, Decl(classExpressionWithStaticProperties1.ts, 0, 17))
static b = 2;
>b : Symbol(C.b, Decl(classExpressionWithStaticProperties1.ts, 1, 17))
static c = C.a + C.b;
>c : Symbol(C.c, Decl(classExpressionWithStaticProperties1.ts, 2, 17))
>C.a : Symbol(C.a, Decl(classExpressionWithStaticProperties1.ts, 0, 17))
>C : Symbol(C, Decl(classExpressionWithStaticProperties1.ts, 0, 7))
>a : Symbol(C.a, Decl(classExpressionWithStaticProperties1.ts, 0, 17))
>C.b : Symbol(C.b, Decl(classExpressionWithStaticProperties1.ts, 1, 17))
>C : Symbol(C, Decl(classExpressionWithStaticProperties1.ts, 0, 7))
>b : Symbol(C.b, Decl(classExpressionWithStaticProperties1.ts, 1, 17))
};

View File

@@ -1,10 +1,25 @@
=== tests/cases/compiler/classExpressionWithStaticProperties1.ts ===
var v = class C { static a = 1; static b = 2 };
var v = class C {
>v : typeof C
>class C { static a = 1; static b = 2 } : typeof C
>class C { static a = 1; static b = 2; static c = C.a + C.b;} : typeof C
>C : typeof C
static a = 1;
>a : number
>1 : number
static b = 2;
>b : number
>2 : number
static c = C.a + C.b;
>c : number
>C.a + C.b : number
>C.a : number
>C : typeof C
>a : number
>C.b : number
>C : typeof C
>b : number
};

View File

@@ -1,5 +1,12 @@
//// [classExpressionWithStaticProperties2.ts]
var v = class C { static a = 1; static b };
var v = class C {
static a = 1;
static b
static c = {
x: "hi"
}
static d = C.c.x + " world";
};
//// [classExpressionWithStaticProperties2.js]
var v = (_a = (function () {
@@ -8,5 +15,9 @@ var v = (_a = (function () {
return C;
}()),
_a.a = 1,
_a.c = {
x: "hi"
},
_a.d = _a.c.x + " world",
_a);
var _a;

View File

@@ -1,7 +1,26 @@
=== tests/cases/compiler/classExpressionWithStaticProperties2.ts ===
var v = class C { static a = 1; static b };
var v = class C {
>v : Symbol(v, Decl(classExpressionWithStaticProperties2.ts, 0, 3))
>C : Symbol(C, Decl(classExpressionWithStaticProperties2.ts, 0, 7))
>a : Symbol(C.a, Decl(classExpressionWithStaticProperties2.ts, 0, 17))
>b : Symbol(C.b, Decl(classExpressionWithStaticProperties2.ts, 0, 31))
static a = 1;
>a : Symbol(C.a, Decl(classExpressionWithStaticProperties2.ts, 0, 17))
static b
>b : Symbol(C.b, Decl(classExpressionWithStaticProperties2.ts, 1, 17))
static c = {
>c : Symbol(C.c, Decl(classExpressionWithStaticProperties2.ts, 2, 12))
x: "hi"
>x : Symbol(x, Decl(classExpressionWithStaticProperties2.ts, 3, 16))
}
static d = C.c.x + " world";
>d : Symbol(C.d, Decl(classExpressionWithStaticProperties2.ts, 5, 5))
>C.c.x : Symbol(x, Decl(classExpressionWithStaticProperties2.ts, 3, 16))
>C.c : Symbol(C.c, Decl(classExpressionWithStaticProperties2.ts, 2, 12))
>C : Symbol(C, Decl(classExpressionWithStaticProperties2.ts, 0, 7))
>c : Symbol(C.c, Decl(classExpressionWithStaticProperties2.ts, 2, 12))
>x : Symbol(x, Decl(classExpressionWithStaticProperties2.ts, 3, 16))
};

View File

@@ -1,9 +1,32 @@
=== tests/cases/compiler/classExpressionWithStaticProperties2.ts ===
var v = class C { static a = 1; static b };
var v = class C {
>v : typeof C
>class C { static a = 1; static b } : typeof C
>class C { static a = 1; static b static c = { x: "hi" } static d = C.c.x + " world"; } : typeof C
>C : typeof C
static a = 1;
>a : number
>1 : number
static b
>b : any
static c = {
>c : { x: string; }
>{ x: "hi" } : { x: string; }
x: "hi"
>x : string
>"hi" : string
}
static d = C.c.x + " world";
>d : string
>C.c.x + " world" : string
>C.c.x : string
>C.c : { x: string; }
>C : typeof C
>c : { x: string; }
>x : string
>" world" : string
};

View File

@@ -0,0 +1,29 @@
//// [classExpressionWithStaticProperties3.ts]
declare var console: any;
const arr: {y(): number}[] = [];
for (let i = 0; i < 3; i++) {
arr.push(class C {
static x = i;
static y = () => C.x * 2;
});
}
arr.forEach(C => console.log(C.y()));
//// [classExpressionWithStaticProperties3.js]
var arr = [];
var _loop_1 = function (i) {
arr.push((_a = (function () {
function C() {
}
return C;
}()),
_a.x = i,
_a.y = function () { return _a.x * 2; },
_a));
};
for (var i = 0; i < 3; i++) {
_loop_1(i);
}
arr.forEach(function (C) { return console.log(C.y()); });
var _a;

View File

@@ -0,0 +1,42 @@
=== tests/cases/compiler/classExpressionWithStaticProperties3.ts ===
declare var console: any;
>console : Symbol(console, Decl(classExpressionWithStaticProperties3.ts, 1, 11))
const arr: {y(): number}[] = [];
>arr : Symbol(arr, Decl(classExpressionWithStaticProperties3.ts, 2, 5))
>y : Symbol(y, Decl(classExpressionWithStaticProperties3.ts, 2, 12))
for (let i = 0; i < 3; i++) {
>i : Symbol(i, Decl(classExpressionWithStaticProperties3.ts, 3, 8))
>i : Symbol(i, Decl(classExpressionWithStaticProperties3.ts, 3, 8))
>i : Symbol(i, Decl(classExpressionWithStaticProperties3.ts, 3, 8))
arr.push(class C {
>arr.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>arr : Symbol(arr, Decl(classExpressionWithStaticProperties3.ts, 2, 5))
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>C : Symbol(C, Decl(classExpressionWithStaticProperties3.ts, 4, 13))
static x = i;
>x : Symbol(C.x, Decl(classExpressionWithStaticProperties3.ts, 4, 22))
>i : Symbol(i, Decl(classExpressionWithStaticProperties3.ts, 3, 8))
static y = () => C.x * 2;
>y : Symbol(C.y, Decl(classExpressionWithStaticProperties3.ts, 5, 21))
>C.x : Symbol(C.x, Decl(classExpressionWithStaticProperties3.ts, 4, 22))
>C : Symbol(C, Decl(classExpressionWithStaticProperties3.ts, 4, 13))
>x : Symbol(C.x, Decl(classExpressionWithStaticProperties3.ts, 4, 22))
});
}
arr.forEach(C => console.log(C.y()));
>arr.forEach : Symbol(Array.forEach, Decl(lib.d.ts, --, --))
>arr : Symbol(arr, Decl(classExpressionWithStaticProperties3.ts, 2, 5))
>forEach : Symbol(Array.forEach, Decl(lib.d.ts, --, --))
>C : Symbol(C, Decl(classExpressionWithStaticProperties3.ts, 9, 12))
>console : Symbol(console, Decl(classExpressionWithStaticProperties3.ts, 1, 11))
>C.y : Symbol(y, Decl(classExpressionWithStaticProperties3.ts, 2, 12))
>C : Symbol(C, Decl(classExpressionWithStaticProperties3.ts, 9, 12))
>y : Symbol(y, Decl(classExpressionWithStaticProperties3.ts, 2, 12))

View File

@@ -0,0 +1,58 @@
=== tests/cases/compiler/classExpressionWithStaticProperties3.ts ===
declare var console: any;
>console : any
const arr: {y(): number}[] = [];
>arr : { y(): number; }[]
>y : () => number
>[] : undefined[]
for (let i = 0; i < 3; i++) {
>i : number
>0 : number
>i < 3 : boolean
>i : number
>3 : number
>i++ : number
>i : number
arr.push(class C {
>arr.push(class C { static x = i; static y = () => C.x * 2; }) : number
>arr.push : (...items: { y(): number; }[]) => number
>arr : { y(): number; }[]
>push : (...items: { y(): number; }[]) => number
>class C { static x = i; static y = () => C.x * 2; } : typeof C
>C : typeof C
static x = i;
>x : number
>i : number
static y = () => C.x * 2;
>y : () => number
>() => C.x * 2 : () => number
>C.x * 2 : number
>C.x : number
>C : typeof C
>x : number
>2 : number
});
}
arr.forEach(C => console.log(C.y()));
>arr.forEach(C => console.log(C.y())) : void
>arr.forEach : (callbackfn: (value: { y(): number; }, index: number, array: { y(): number; }[]) => void, thisArg?: any) => void
>arr : { y(): number; }[]
>forEach : (callbackfn: (value: { y(): number; }, index: number, array: { y(): number; }[]) => void, thisArg?: any) => void
>C => console.log(C.y()) : (C: { y(): number; }) => any
>C : { y(): number; }
>console.log(C.y()) : any
>console.log : any
>console : any
>log : any
>C.y() : number
>C.y : () => number
>C : { y(): number; }
>y : () => number

View File

@@ -1 +1,5 @@
var v = class C { static a = 1; static b = 2 };
var v = class C {
static a = 1;
static b = 2;
static c = C.a + C.b;
};

View File

@@ -1 +1,9 @@
var v = class C { static a = 1; static b };
//@target: es5
var v = class C {
static a = 1;
static b
static c = {
x: "hi"
}
static d = C.c.x + " world";
};

View File

@@ -0,0 +1,11 @@
//@target: es5
declare var console: any;
const arr: {y(): number}[] = [];
for (let i = 0; i < 3; i++) {
arr.push(class C {
static x = i;
static y = () => C.x * 2;
});
}
arr.forEach(C => console.log(C.y()));