mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Add test cases for simple js file compilations
This commit is contained in:
parent
fad0db2a0b
commit
d3dfd2afef
@ -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;
|
||||
@ -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))
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
class c {
|
||||
>c : c
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/b.js ===
|
||||
function foo() {
|
||||
>foo : () => void
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -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))
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
19
tests/baselines/reference/jsFileCompilationWithOut.js
Normal file
19
tests/baselines/reference/jsFileCompilationWithOut.js
Normal 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() {
|
||||
}
|
||||
10
tests/baselines/reference/jsFileCompilationWithOut.symbols
Normal file
10
tests/baselines/reference/jsFileCompilationWithOut.symbols
Normal 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))
|
||||
}
|
||||
|
||||
10
tests/baselines/reference/jsFileCompilationWithOut.types
Normal file
10
tests/baselines/reference/jsFileCompilationWithOut.types
Normal file
@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
class c {
|
||||
>c : c
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/b.js ===
|
||||
function foo() {
|
||||
>foo : () => void
|
||||
}
|
||||
|
||||
@ -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() {
|
||||
}
|
||||
|
||||
17
tests/baselines/reference/jsFileCompilationWithoutOut.js
Normal file
17
tests/baselines/reference/jsFileCompilationWithoutOut.js
Normal 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;
|
||||
})();
|
||||
@ -0,0 +1,9 @@
|
||||
// @out: out.js
|
||||
// @declaration: true
|
||||
// @filename: a.ts
|
||||
class c {
|
||||
}
|
||||
|
||||
// @filename: b.js
|
||||
function foo() {
|
||||
}
|
||||
@ -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() {
|
||||
}
|
||||
8
tests/cases/compiler/jsFileCompilationWithOut.ts
Normal file
8
tests/cases/compiler/jsFileCompilationWithOut.ts
Normal file
@ -0,0 +1,8 @@
|
||||
// @out: out.js
|
||||
// @filename: a.ts
|
||||
class c {
|
||||
}
|
||||
|
||||
// @filename: b.js
|
||||
function foo() {
|
||||
}
|
||||
7
tests/cases/compiler/jsFileCompilationWithoutOut.ts
Normal file
7
tests/cases/compiler/jsFileCompilationWithoutOut.ts
Normal file
@ -0,0 +1,7 @@
|
||||
// @filename: a.ts
|
||||
class c {
|
||||
}
|
||||
|
||||
// @filename: b.js
|
||||
function foo() {
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user