Add test for function export

This commit is contained in:
Ryan Cavanaugh
2016-03-09 16:24:54 -08:00
parent c72f1c354b
commit 8cef251b14
4 changed files with 61 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
//// [tests/cases/conformance/externalModules/umd7.ts] ////
//// [foo.d.ts]
declare function Thing(): number;
export = Thing;
export as namespace Foo;
//// [a.ts]
/// <reference path="foo.d.ts" />
let y: number = Foo();
//// [a.js]
/// <reference path="foo.d.ts" />
var y = exports.Foo();

View File

@@ -0,0 +1,16 @@
=== tests/cases/conformance/externalModules/a.ts ===
/// <reference path="foo.d.ts" />
let y: number = Foo();
>y : Symbol(y, Decl(a.ts, 1, 3))
>Foo : Symbol(Foo, Decl(foo.d.ts, 2, 15))
=== tests/cases/conformance/externalModules/foo.d.ts ===
declare function Thing(): number;
>Thing : Symbol(Thing, Decl(foo.d.ts, 0, 0))
export = Thing;
>Thing : Symbol(Thing, Decl(foo.d.ts, 0, 0))
export as namespace Foo;

View File

@@ -0,0 +1,18 @@
=== tests/cases/conformance/externalModules/a.ts ===
/// <reference path="foo.d.ts" />
let y: number = Foo();
>y : number
>Foo() : number
>Foo : () => number
=== tests/cases/conformance/externalModules/foo.d.ts ===
declare function Thing(): number;
>Thing : () => number
export = Thing;
>Thing : () => number
export as namespace Foo;
>Foo : any

View File

@@ -0,0 +1,11 @@
// @module: commonjs
// @noImplicitReferences: true
// @filename: foo.d.ts
declare function Thing(): number;
export = Thing;
export as namespace Foo;
// @filename: a.ts
/// <reference path="foo.d.ts" />
let y: number = Foo();