mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Add test cases for simple js file compilations
This commit is contained in:
@@ -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;
|
||||
})();
|
||||
Reference in New Issue
Block a user