Add test cases for simple js file compilations

This commit is contained in:
Sheetal Nandi 2015-09-10 11:01:13 -07:00
parent fad0db2a0b
commit d3dfd2afef
15 changed files with 214 additions and 0 deletions

View File

@ -0,0 +1,25 @@
//// [tests/cases/compiler/jsFileCompilationEmitDeclarations.ts] ////
//// [a.ts]
class c {
}
//// [b.js]
function foo() {
}
//// [out.js]
var c = (function () {
function c() {
}
return c;
})();
function foo() {
}
//// [out.d.ts]
declare class c {
}
declare function foo(): void;

View File

@ -0,0 +1,10 @@
=== tests/cases/compiler/a.ts ===
class c {
>c : Symbol(c, Decl(a.ts, 0, 0))
}
=== tests/cases/compiler/b.js ===
function foo() {
>foo : Symbol(foo, Decl(b.js, 0, 0))
}

View File

@ -0,0 +1,10 @@
=== tests/cases/compiler/a.ts ===
class c {
>c : c
}
=== tests/cases/compiler/b.js ===
function foo() {
>foo : () => void
}

View File

@ -0,0 +1,33 @@
//// [tests/cases/compiler/jsFileCompilationEmitTrippleSlashReference.ts] ////
//// [a.ts]
class c {
}
//// [b.js]
/// <reference path="c.js"/>
function foo() {
}
//// [c.js]
function bar() {
}
//// [out.js]
var c = (function () {
function c() {
}
return c;
})();
function bar() {
}
/// <reference path="c.js"/>
function foo() {
}
//// [out.d.ts]
declare class c {
}
declare function bar(): void;
declare function foo(): void;

View File

@ -0,0 +1,15 @@
=== tests/cases/compiler/a.ts ===
class c {
>c : Symbol(c, Decl(a.ts, 0, 0))
}
=== tests/cases/compiler/b.js ===
/// <reference path="c.js"/>
function foo() {
>foo : Symbol(foo, Decl(b.js, 0, 0))
}
=== tests/cases/compiler/c.js ===
function bar() {
>bar : Symbol(bar, Decl(c.js, 0, 0))
}

View File

@ -0,0 +1,15 @@
=== tests/cases/compiler/a.ts ===
class c {
>c : c
}
=== tests/cases/compiler/b.js ===
/// <reference path="c.js"/>
function foo() {
>foo : () => void
}
=== tests/cases/compiler/c.js ===
function bar() {
>bar : () => void
}

View File

@ -0,0 +1,19 @@
//// [tests/cases/compiler/jsFileCompilationWithOut.ts] ////
//// [a.ts]
class c {
}
//// [b.js]
function foo() {
}
//// [out.js]
var c = (function () {
function c() {
}
return c;
})();
function foo() {
}

View File

@ -0,0 +1,10 @@
=== tests/cases/compiler/a.ts ===
class c {
>c : Symbol(c, Decl(a.ts, 0, 0))
}
=== tests/cases/compiler/b.js ===
function foo() {
>foo : Symbol(foo, Decl(b.js, 0, 0))
}

View File

@ -0,0 +1,10 @@
=== tests/cases/compiler/a.ts ===
class c {
>c : c
}
=== tests/cases/compiler/b.js ===
function foo() {
>foo : () => void
}

View File

@ -0,0 +1,12 @@
error TS5054: Could not write file 'tests/cases/compiler/b.js' which is one of the input files.
!!! error TS5054: Could not write file 'tests/cases/compiler/b.js' which is one of the input files.
==== tests/cases/compiler/a.ts (0 errors) ====
class c {
}
==== tests/cases/compiler/b.js (0 errors) ====
function foo() {
}

View File

@ -0,0 +1,17 @@
//// [tests/cases/compiler/jsFileCompilationWithoutOut.ts] ////
//// [a.ts]
class c {
}
//// [b.js]
function foo() {
}
//// [a.js]
var c = (function () {
function c() {
}
return c;
})();

View File

@ -0,0 +1,9 @@
// @out: out.js
// @declaration: true
// @filename: a.ts
class c {
}
// @filename: b.js
function foo() {
}

View File

@ -0,0 +1,14 @@
// @out: out.js
// @declaration: true
// @filename: a.ts
class c {
}
// @filename: b.js
/// <reference path="c.js"/>
function foo() {
}
// @filename: c.js
function bar() {
}

View File

@ -0,0 +1,8 @@
// @out: out.js
// @filename: a.ts
class c {
}
// @filename: b.js
function foo() {
}

View File

@ -0,0 +1,7 @@
// @filename: a.ts
class c {
}
// @filename: b.js
function foo() {
}