Add tests for more kinds of import/export

This commit is contained in:
Andy Hanson 2016-06-09 12:46:52 -07:00
parent 75c1d77606
commit 9fa971091c
8 changed files with 106 additions and 6 deletions

View File

@ -9,7 +9,8 @@ declare module "fs";
///<reference path="declarations.d.ts"/>
import foo, {bar} from "jquery";
import * as baz from "fs";
foo(bar, baz);
import boom = require("jquery");
foo(bar, baz, boom);
//// [user.js]
@ -17,4 +18,5 @@ foo(bar, baz);
///<reference path="declarations.d.ts"/>
var jquery_1 = require("jquery");
var baz = require("fs");
jquery_1["default"](jquery_1.bar, baz);
var boom = require("jquery");
jquery_1["default"](jquery_1.bar, baz, boom);

View File

@ -7,10 +7,14 @@ import foo, {bar} from "jquery";
import * as baz from "fs";
>baz : Symbol(baz, Decl(user.ts, 2, 6))
foo(bar, baz);
import boom = require("jquery");
>boom : Symbol(boom, Decl(user.ts, 2, 26))
foo(bar, baz, boom);
>foo : Symbol(foo, Decl(user.ts, 1, 6))
>bar : Symbol(bar, Decl(user.ts, 1, 13))
>baz : Symbol(baz, Decl(user.ts, 2, 6))
>boom : Symbol(boom, Decl(user.ts, 2, 26))
=== tests/cases/conformance/ambient/declarations.d.ts ===
declare module "jquery"

View File

@ -7,11 +7,15 @@ import foo, {bar} from "jquery";
import * as baz from "fs";
>baz : any
foo(bar, baz);
>foo(bar, baz) : any
import boom = require("jquery");
>boom : any
foo(bar, baz, boom);
>foo(bar, baz, boom) : any
>foo : any
>bar : any
>baz : any
>boom : any
=== tests/cases/conformance/ambient/declarations.d.ts ===
declare module "jquery"

View File

@ -0,0 +1,30 @@
//// [tests/cases/conformance/ambient/ambientShorthand_reExport.ts] ////
//// [declarations.d.ts]
declare module "jquery";
//// [reExportX.ts]
export {x} from "jquery";
//// [reExportAll.ts]
export * from "jquery";
//// [reExportUser.ts]
import {x} from "./reExportX";
import * as $ from "./reExportAll";
// '$' is not callable, it is an object.
x($);
//// [reExportX.js]
"use strict";
var jquery_1 = require("jquery");
exports.x = jquery_1.x;
//// [reExportAll.js]
"use strict";
//// [reExportUser.js]
"use strict";
var reExportX_1 = require("./reExportX");
var $ = require("./reExportAll");
// '$' is not callable, it is an object.
reExportX_1.x($);

View File

@ -0,0 +1,22 @@
=== tests/cases/conformance/ambient/declarations.d.ts ===
declare module "jquery";
No type information for this code.
No type information for this code.=== tests/cases/conformance/ambient/reExportX.ts ===
export {x} from "jquery";
>x : Symbol(x, Decl(reExportX.ts, 0, 8))
=== tests/cases/conformance/ambient/reExportAll.ts ===
export * from "jquery";
No type information for this code.
No type information for this code.=== tests/cases/conformance/ambient/reExportUser.ts ===
import {x} from "./reExportX";
>x : Symbol(x, Decl(reExportUser.ts, 0, 8))
import * as $ from "./reExportAll";
>$ : Symbol($, Decl(reExportUser.ts, 1, 6))
// '$' is not callable, it is an object.
x($);
>x : Symbol(x, Decl(reExportUser.ts, 0, 8))
>$ : Symbol($, Decl(reExportUser.ts, 1, 6))

View File

@ -0,0 +1,23 @@
=== tests/cases/conformance/ambient/declarations.d.ts ===
declare module "jquery";
No type information for this code.
No type information for this code.=== tests/cases/conformance/ambient/reExportX.ts ===
export {x} from "jquery";
>x : any
=== tests/cases/conformance/ambient/reExportAll.ts ===
export * from "jquery";
No type information for this code.
No type information for this code.=== tests/cases/conformance/ambient/reExportUser.ts ===
import {x} from "./reExportX";
>x : any
import * as $ from "./reExportAll";
>$ : typeof $
// '$' is not callable, it is an object.
x($);
>x($) : any
>x : any
>$ : typeof $

View File

@ -7,4 +7,5 @@ declare module "fs";
///<reference path="declarations.d.ts"/>
import foo, {bar} from "jquery";
import * as baz from "fs";
foo(bar, baz);
import boom = require("jquery");
foo(bar, baz, boom);

View File

@ -0,0 +1,14 @@
// @Filename: declarations.d.ts
declare module "jquery";
// @Filename: reExportX.ts
export {x} from "jquery";
// @Filename: reExportAll.ts
export * from "jquery";
// @Filename: reExportUser.ts
import {x} from "./reExportX";
import * as $ from "./reExportAll";
// '$' is not callable, it is an object.
x($);