Add more tests for target=es5 module=es6

This commit is contained in:
Mohamed Hegazy 2016-06-08 16:46:55 -07:00
parent 8360bc7961
commit 33137f68c5
16 changed files with 222 additions and 0 deletions

View file

@ -0,0 +1,19 @@
//// [es6modulekindWithES5Target5.ts]
export enum E1 {
value1
}
export const enum E2 {
value1
}
//// [es6modulekindWithES5Target5.js]
export var E1;
(function (E1) {
E1[E1["value1"] = 0] = "value1";
})(E1 || (E1 = {}));
export var E2;
(function (E2) {
E2[E2["value1"] = 0] = "value1";
})(E2 || (E2 = {}));

View file

@ -0,0 +1,15 @@
=== tests/cases/compiler/es6modulekindWithES5Target5.ts ===
export enum E1 {
>E1 : Symbol(E1, Decl(es6modulekindWithES5Target5.ts, 0, 0))
value1
>value1 : Symbol(E1.value1, Decl(es6modulekindWithES5Target5.ts, 1, 16))
}
export const enum E2 {
>E2 : Symbol(E2, Decl(es6modulekindWithES5Target5.ts, 3, 1))
value1
>value1 : Symbol(E2.value1, Decl(es6modulekindWithES5Target5.ts, 5, 22))
}

View file

@ -0,0 +1,15 @@
=== tests/cases/compiler/es6modulekindWithES5Target5.ts ===
export enum E1 {
>E1 : E1
value1
>value1 : E1
}
export const enum E2 {
>E2 : E2
value1
>value1 : E2
}

View file

@ -0,0 +1,25 @@
//// [es6modulekindWithES5Target6.ts]
export function f1(d = 0) {
}
export function f2(...arg) {
}
export default function f3(d = 0) {
}
//// [es6modulekindWithES5Target6.js]
export function f1(d) {
if (d === void 0) { d = 0; }
}
export function f2() {
var arg = [];
for (var _i = 0; _i < arguments.length; _i++) {
arg[_i - 0] = arguments[_i];
}
}
export default function f3(d) {
if (d === void 0) { d = 0; }
}

View file

@ -0,0 +1,17 @@
=== tests/cases/compiler/es6modulekindWithES5Target6.ts ===
export function f1(d = 0) {
>f1 : Symbol(f1, Decl(es6modulekindWithES5Target6.ts, 0, 0))
>d : Symbol(d, Decl(es6modulekindWithES5Target6.ts, 1, 19))
}
export function f2(...arg) {
>f2 : Symbol(f2, Decl(es6modulekindWithES5Target6.ts, 2, 1))
>arg : Symbol(arg, Decl(es6modulekindWithES5Target6.ts, 4, 19))
}
export default function f3(d = 0) {
>f3 : Symbol(f3, Decl(es6modulekindWithES5Target6.ts, 5, 1))
>d : Symbol(d, Decl(es6modulekindWithES5Target6.ts, 7, 27))
}

View file

@ -0,0 +1,19 @@
=== tests/cases/compiler/es6modulekindWithES5Target6.ts ===
export function f1(d = 0) {
>f1 : (d?: number) => void
>d : number
>0 : number
}
export function f2(...arg) {
>f2 : (...arg: any[]) => void
>arg : any[]
}
export default function f3(d = 0) {
>f3 : (d?: number) => void
>d : number
>0 : number
}

View file

@ -0,0 +1,16 @@
//// [es6modulekindWithES5Target7.ts]
export namespace N {
var x = 0;
}
export namespace N2 {
export interface I { }
}
//// [es6modulekindWithES5Target7.js]
export var N;
(function (N) {
var x = 0;
})(N || (N = {}));

View file

@ -0,0 +1,16 @@
=== tests/cases/compiler/es6modulekindWithES5Target7.ts ===
export namespace N {
>N : Symbol(N, Decl(es6modulekindWithES5Target7.ts, 0, 0))
var x = 0;
>x : Symbol(x, Decl(es6modulekindWithES5Target7.ts, 2, 7))
}
export namespace N2 {
>N2 : Symbol(N2, Decl(es6modulekindWithES5Target7.ts, 3, 1))
export interface I { }
>I : Symbol(I, Decl(es6modulekindWithES5Target7.ts, 5, 21))
}

View file

@ -0,0 +1,17 @@
=== tests/cases/compiler/es6modulekindWithES5Target7.ts ===
export namespace N {
>N : typeof N
var x = 0;
>x : number
>0 : number
}
export namespace N2 {
>N2 : any
export interface I { }
>I : I
}

View file

@ -0,0 +1,8 @@
//// [es6modulekindWithES5Target8.ts]
export const c = 0;
export let l = 1;
//// [es6modulekindWithES5Target8.js]
export var c = 0;
export var l = 1;

View file

@ -0,0 +1,8 @@
=== tests/cases/compiler/es6modulekindWithES5Target8.ts ===
export const c = 0;
>c : Symbol(c, Decl(es6modulekindWithES5Target8.ts, 1, 12))
export let l = 1;
>l : Symbol(l, Decl(es6modulekindWithES5Target8.ts, 2, 10))

View file

@ -0,0 +1,10 @@
=== tests/cases/compiler/es6modulekindWithES5Target8.ts ===
export const c = 0;
>c : number
>0 : number
export let l = 1;
>l : number
>1 : number

View file

@ -0,0 +1,11 @@
// @target: es5
// @module: es2015
// @preserveConstEnums: true
export enum E1 {
value1
}
export const enum E2 {
value1
}

View file

@ -0,0 +1,11 @@
// @target: es5
// @module: es2015
export function f1(d = 0) {
}
export function f2(...arg) {
}
export default function f3(d = 0) {
}

View file

@ -0,0 +1,10 @@
// @target: es5
// @module: es2015
export namespace N {
var x = 0;
}
export namespace N2 {
export interface I { }
}

View file

@ -0,0 +1,5 @@
// @target: es5
// @module: es2015
export const c = 0;
export let l = 1;