Merge pull request #10413 from Microsoft/export_equals_property_test

Add more tests for `export = foo.bar`.
This commit is contained in:
Andy
2016-08-18 09:02:24 -07:00
committed by GitHub
8 changed files with 225 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
//// [tests/cases/compiler/exportDefaultProperty2.ts] ////
//// [a.ts]
// This test is just like exportEqualsProperty2, but with `export default`.
class C {
static B: number;
}
namespace C {
export interface B { c: number }
}
export default C.B;
//// [b.ts]
import B from "./a.ts";
const x: B = { c: B };
//// [a.js]
// This test is just like exportEqualsProperty2, but with `export default`.
"use strict";
var C = (function () {
function C() {
}
return C;
}());
exports.__esModule = true;
exports["default"] = C.B;
//// [b.js]
"use strict";
var a_ts_1 = require("./a.ts");
var x = { c: a_ts_1["default"] };

View File

@@ -0,0 +1,32 @@
=== tests/cases/compiler/a.ts ===
// This test is just like exportEqualsProperty2, but with `export default`.
class C {
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(a.ts, 4, 1))
static B: number;
>B : Symbol(default, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
}
namespace C {
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(a.ts, 4, 1))
export interface B { c: number }
>B : Symbol(B, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
>c : Symbol(B.c, Decl(a.ts, 6, 24))
}
export default C.B;
>C.B : Symbol(default, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(a.ts, 4, 1))
>B : Symbol(default, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
=== tests/cases/compiler/b.ts ===
import B from "./a.ts";
>B : Symbol(B, Decl(b.ts, 0, 6))
const x: B = { c: B };
>x : Symbol(x, Decl(b.ts, 1, 5))
>B : Symbol(B, Decl(b.ts, 0, 6))
>c : Symbol(c, Decl(b.ts, 1, 14))
>B : Symbol(B, Decl(b.ts, 0, 6))

View File

@@ -0,0 +1,33 @@
=== tests/cases/compiler/a.ts ===
// This test is just like exportEqualsProperty2, but with `export default`.
class C {
>C : C
static B: number;
>B : number
}
namespace C {
>C : typeof C
export interface B { c: number }
>B : B
>c : number
}
export default C.B;
>C.B : number
>C : typeof C
>B : number
=== tests/cases/compiler/b.ts ===
import B from "./a.ts";
>B : number
const x: B = { c: B };
>x : B
>B : B
>{ c: B } : { c: number; }
>c : number
>B : number

View File

@@ -0,0 +1,32 @@
//// [tests/cases/compiler/exportEqualsProperty2.ts] ////
//// [a.ts]
// This test is just like exportDefaultProperty2, but with `export =`.
class C {
static B: number;
}
namespace C {
export interface B { c: number }
}
export = C.B;
//// [b.ts]
import B = require("./a.ts");
const x: B = { c: B };
//// [a.js]
// This test is just like exportDefaultProperty2, but with `export =`.
"use strict";
var C = (function () {
function C() {
}
return C;
}());
module.exports = C.B;
//// [b.js]
"use strict";
var B = require("./a.ts");
var x = { c: B };

View File

@@ -0,0 +1,32 @@
=== tests/cases/compiler/b.ts ===
import B = require("./a.ts");
>B : Symbol(B, Decl(b.ts, 0, 0))
const x: B = { c: B };
>x : Symbol(x, Decl(b.ts, 1, 5))
>B : Symbol(B, Decl(b.ts, 0, 0))
>c : Symbol(c, Decl(b.ts, 1, 14))
>B : Symbol(B, Decl(b.ts, 0, 0))
=== tests/cases/compiler/a.ts ===
// This test is just like exportDefaultProperty2, but with `export =`.
class C {
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(a.ts, 4, 1))
static B: number;
>B : Symbol(C.B, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
}
namespace C {
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(a.ts, 4, 1))
export interface B { c: number }
>B : Symbol(B, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
>c : Symbol(B.c, Decl(a.ts, 6, 24))
}
export = C.B;
>C.B : Symbol(C.B, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(a.ts, 4, 1))
>B : Symbol(C.B, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))

View File

@@ -0,0 +1,33 @@
=== tests/cases/compiler/b.ts ===
import B = require("./a.ts");
>B : number
const x: B = { c: B };
>x : B
>B : B
>{ c: B } : { c: number; }
>c : number
>B : number
=== tests/cases/compiler/a.ts ===
// This test is just like exportDefaultProperty2, but with `export =`.
class C {
>C : C
static B: number;
>B : number
}
namespace C {
>C : typeof C
export interface B { c: number }
>B : B
>c : number
}
export = C.B;
>C.B : number
>C : typeof C
>B : number

View File

@@ -0,0 +1,15 @@
// This test is just like exportEqualsProperty2, but with `export default`.
// @Filename: a.ts
class C {
static B: number;
}
namespace C {
export interface B { c: number }
}
export default C.B;
// @Filename: b.ts
import B from "./a.ts";
const x: B = { c: B };

View File

@@ -0,0 +1,15 @@
// This test is just like exportDefaultProperty2, but with `export =`.
// @Filename: a.ts
class C {
static B: number;
}
namespace C {
export interface B { c: number }
}
export = C.B;
// @Filename: b.ts
import B = require("./a.ts");
const x: B = { c: B };