Skip to content

Commit 4e40b75

Browse files
author
Andy
authored
Merge pull request #10413 from Microsoft/export_equals_property_test
Add more tests for `export = foo.bar`.
2 parents da8fc5d + 2e57220 commit 4e40b75

8 files changed

+225
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//// [tests/cases/compiler/exportDefaultProperty2.ts] ////
2+
3+
//// [a.ts]
4+
// This test is just like exportEqualsProperty2, but with `export default`.
5+
6+
class C {
7+
static B: number;
8+
}
9+
namespace C {
10+
export interface B { c: number }
11+
}
12+
13+
export default C.B;
14+
15+
//// [b.ts]
16+
import B from "./a.ts";
17+
const x: B = { c: B };
18+
19+
20+
//// [a.js]
21+
// This test is just like exportEqualsProperty2, but with `export default`.
22+
"use strict";
23+
var C = (function () {
24+
function C() {
25+
}
26+
return C;
27+
}());
28+
exports.__esModule = true;
29+
exports["default"] = C.B;
30+
//// [b.js]
31+
"use strict";
32+
var a_ts_1 = require("./a.ts");
33+
var x = { c: a_ts_1["default"] };
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
=== tests/cases/compiler/a.ts ===
2+
// This test is just like exportEqualsProperty2, but with `export default`.
3+
4+
class C {
5+
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(a.ts, 4, 1))
6+
7+
static B: number;
8+
>B : Symbol(default, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
9+
}
10+
namespace C {
11+
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(a.ts, 4, 1))
12+
13+
export interface B { c: number }
14+
>B : Symbol(B, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
15+
>c : Symbol(B.c, Decl(a.ts, 6, 24))
16+
}
17+
18+
export default C.B;
19+
>C.B : Symbol(default, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
20+
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(a.ts, 4, 1))
21+
>B : Symbol(default, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
22+
23+
=== tests/cases/compiler/b.ts ===
24+
import B from "./a.ts";
25+
>B : Symbol(B, Decl(b.ts, 0, 6))
26+
27+
const x: B = { c: B };
28+
>x : Symbol(x, Decl(b.ts, 1, 5))
29+
>B : Symbol(B, Decl(b.ts, 0, 6))
30+
>c : Symbol(c, Decl(b.ts, 1, 14))
31+
>B : Symbol(B, Decl(b.ts, 0, 6))
32+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
=== tests/cases/compiler/a.ts ===
2+
// This test is just like exportEqualsProperty2, but with `export default`.
3+
4+
class C {
5+
>C : C
6+
7+
static B: number;
8+
>B : number
9+
}
10+
namespace C {
11+
>C : typeof C
12+
13+
export interface B { c: number }
14+
>B : B
15+
>c : number
16+
}
17+
18+
export default C.B;
19+
>C.B : number
20+
>C : typeof C
21+
>B : number
22+
23+
=== tests/cases/compiler/b.ts ===
24+
import B from "./a.ts";
25+
>B : number
26+
27+
const x: B = { c: B };
28+
>x : B
29+
>B : B
30+
>{ c: B } : { c: number; }
31+
>c : number
32+
>B : number
33+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//// [tests/cases/compiler/exportEqualsProperty2.ts] ////
2+
3+
//// [a.ts]
4+
// This test is just like exportDefaultProperty2, but with `export =`.
5+
6+
class C {
7+
static B: number;
8+
}
9+
namespace C {
10+
export interface B { c: number }
11+
}
12+
13+
export = C.B;
14+
15+
//// [b.ts]
16+
import B = require("./a.ts");
17+
const x: B = { c: B };
18+
19+
20+
//// [a.js]
21+
// This test is just like exportDefaultProperty2, but with `export =`.
22+
"use strict";
23+
var C = (function () {
24+
function C() {
25+
}
26+
return C;
27+
}());
28+
module.exports = C.B;
29+
//// [b.js]
30+
"use strict";
31+
var B = require("./a.ts");
32+
var x = { c: B };
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
=== tests/cases/compiler/b.ts ===
2+
import B = require("./a.ts");
3+
>B : Symbol(B, Decl(b.ts, 0, 0))
4+
5+
const x: B = { c: B };
6+
>x : Symbol(x, Decl(b.ts, 1, 5))
7+
>B : Symbol(B, Decl(b.ts, 0, 0))
8+
>c : Symbol(c, Decl(b.ts, 1, 14))
9+
>B : Symbol(B, Decl(b.ts, 0, 0))
10+
11+
=== tests/cases/compiler/a.ts ===
12+
// This test is just like exportDefaultProperty2, but with `export =`.
13+
14+
class C {
15+
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(a.ts, 4, 1))
16+
17+
static B: number;
18+
>B : Symbol(C.B, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
19+
}
20+
namespace C {
21+
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(a.ts, 4, 1))
22+
23+
export interface B { c: number }
24+
>B : Symbol(B, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
25+
>c : Symbol(B.c, Decl(a.ts, 6, 24))
26+
}
27+
28+
export = C.B;
29+
>C.B : Symbol(C.B, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
30+
>C : Symbol(C, Decl(a.ts, 0, 0), Decl(a.ts, 4, 1))
31+
>B : Symbol(C.B, Decl(a.ts, 2, 9), Decl(a.ts, 5, 13))
32+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
=== tests/cases/compiler/b.ts ===
2+
import B = require("./a.ts");
3+
>B : number
4+
5+
const x: B = { c: B };
6+
>x : B
7+
>B : B
8+
>{ c: B } : { c: number; }
9+
>c : number
10+
>B : number
11+
12+
=== tests/cases/compiler/a.ts ===
13+
// This test is just like exportDefaultProperty2, but with `export =`.
14+
15+
class C {
16+
>C : C
17+
18+
static B: number;
19+
>B : number
20+
}
21+
namespace C {
22+
>C : typeof C
23+
24+
export interface B { c: number }
25+
>B : B
26+
>c : number
27+
}
28+
29+
export = C.B;
30+
>C.B : number
31+
>C : typeof C
32+
>B : number
33+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This test is just like exportEqualsProperty2, but with `export default`.
2+
3+
// @Filename: a.ts
4+
class C {
5+
static B: number;
6+
}
7+
namespace C {
8+
export interface B { c: number }
9+
}
10+
11+
export default C.B;
12+
13+
// @Filename: b.ts
14+
import B from "./a.ts";
15+
const x: B = { c: B };
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This test is just like exportDefaultProperty2, but with `export =`.
2+
3+
// @Filename: a.ts
4+
class C {
5+
static B: number;
6+
}
7+
namespace C {
8+
export interface B { c: number }
9+
}
10+
11+
export = C.B;
12+
13+
// @Filename: b.ts
14+
import B = require("./a.ts");
15+
const x: B = { c: B };

0 commit comments

Comments
 (0)