Skip to content

Commit 500861c

Browse files
committed
Test cases that address microsoft#4288
1 parent 7c8da42 commit 500861c

8 files changed

Lines changed: 199 additions & 0 deletions
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//// [tests/cases/conformance/classes/classExpressions/extendClassExpressionFromModule.ts] ////
2+
3+
//// [foo1.ts]
4+
class x{}
5+
6+
export = x;
7+
8+
//// [foo2.ts]
9+
import foo1 = require('./foo1');
10+
var x = foo1;
11+
class y extends x {}
12+
13+
14+
//// [foo1.js]
15+
var x = (function () {
16+
function x() {
17+
}
18+
return x;
19+
})();
20+
module.exports = x;
21+
//// [foo2.js]
22+
var __extends = (this && this.__extends) || function (d, b) {
23+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
24+
function __() { this.constructor = d; }
25+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26+
};
27+
var foo1 = require('./foo1');
28+
var x = foo1;
29+
var y = (function (_super) {
30+
__extends(y, _super);
31+
function y() {
32+
_super.apply(this, arguments);
33+
}
34+
return y;
35+
})(x);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
=== tests/cases/conformance/classes/classExpressions/foo2.ts ===
2+
import foo1 = require('./foo1');
3+
>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0))
4+
5+
var x = foo1;
6+
>x : Symbol(x, Decl(foo2.ts, 1, 3))
7+
>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0))
8+
9+
class y extends x {}
10+
>y : Symbol(y, Decl(foo2.ts, 1, 13))
11+
12+
=== tests/cases/conformance/classes/classExpressions/foo1.ts ===
13+
class x{}
14+
>x : Symbol(x, Decl(foo1.ts, 0, 0))
15+
16+
export = x;
17+
>x : Symbol(x, Decl(foo1.ts, 0, 0))
18+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
=== tests/cases/conformance/classes/classExpressions/foo2.ts ===
2+
import foo1 = require('./foo1');
3+
>foo1 : typeof foo1
4+
5+
var x = foo1;
6+
>x : typeof foo1
7+
>foo1 : typeof foo1
8+
9+
class y extends x {}
10+
>y : y
11+
>x : foo1
12+
13+
=== tests/cases/conformance/classes/classExpressions/foo1.ts ===
14+
class x{}
15+
>x : x
16+
17+
export = x;
18+
>x : x
19+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//// [tests/cases/conformance/externalModules/reexportClassDefinition.ts] ////
2+
3+
//// [foo1.ts]
4+
class x{}
5+
export = x;
6+
7+
//// [foo2.ts]
8+
import foo1 = require('./foo1');
9+
10+
export = {
11+
x: foo1
12+
}
13+
14+
//// [foo3.ts]
15+
import foo2 = require('./foo2')
16+
class x extends foo2.x {}
17+
18+
19+
20+
//// [foo1.js]
21+
var x = (function () {
22+
function x() {
23+
}
24+
return x;
25+
})();
26+
module.exports = x;
27+
//// [foo2.js]
28+
var foo1 = require('./foo1');
29+
module.exports = {
30+
x: foo1
31+
};
32+
//// [foo3.js]
33+
var __extends = (this && this.__extends) || function (d, b) {
34+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
35+
function __() { this.constructor = d; }
36+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
37+
};
38+
var foo2 = require('./foo2');
39+
var x = (function (_super) {
40+
__extends(x, _super);
41+
function x() {
42+
_super.apply(this, arguments);
43+
}
44+
return x;
45+
})(foo2.x);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
=== tests/cases/conformance/externalModules/foo3.ts ===
2+
import foo2 = require('./foo2')
3+
>foo2 : Symbol(foo2, Decl(foo3.ts, 0, 0))
4+
5+
class x extends foo2.x {}
6+
>x : Symbol(x, Decl(foo3.ts, 0, 31))
7+
>foo2 : Symbol(foo2, Decl(foo3.ts, 0, 0))
8+
9+
10+
=== tests/cases/conformance/externalModules/foo1.ts ===
11+
class x{}
12+
>x : Symbol(x, Decl(foo1.ts, 0, 0))
13+
14+
export = x;
15+
>x : Symbol(x, Decl(foo1.ts, 0, 0))
16+
17+
=== tests/cases/conformance/externalModules/foo2.ts ===
18+
import foo1 = require('./foo1');
19+
>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0))
20+
21+
export = {
22+
x: foo1
23+
>x : Symbol(x, Decl(foo2.ts, 2, 10))
24+
>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0))
25+
}
26+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
=== tests/cases/conformance/externalModules/foo3.ts ===
2+
import foo2 = require('./foo2')
3+
>foo2 : { x: typeof x; }
4+
5+
class x extends foo2.x {}
6+
>x : x
7+
>foo2.x : x
8+
>foo2 : { x: typeof x; }
9+
>x : typeof x
10+
11+
12+
=== tests/cases/conformance/externalModules/foo1.ts ===
13+
class x{}
14+
>x : x
15+
16+
export = x;
17+
>x : x
18+
19+
=== tests/cases/conformance/externalModules/foo2.ts ===
20+
import foo1 = require('./foo1');
21+
>foo1 : typeof foo1
22+
23+
export = {
24+
>{ x: foo1} : { x: typeof foo1; }
25+
26+
x: foo1
27+
>x : typeof foo1
28+
>foo1 : typeof foo1
29+
}
30+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @module: commonjs
2+
// @Filename: foo1.ts
3+
class x{}
4+
5+
export = x;
6+
7+
// @Filename: foo2.ts
8+
import foo1 = require('./foo1');
9+
var x = foo1;
10+
class y extends x {}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// @module: commonjs
2+
// @Filename: foo1.ts
3+
class x{}
4+
export = x;
5+
6+
// @Filename: foo2.ts
7+
import foo1 = require('./foo1');
8+
9+
export = {
10+
x: foo1
11+
}
12+
13+
// @Filename: foo3.ts
14+
import foo2 = require('./foo2')
15+
class x extends foo2.x {}
16+

0 commit comments

Comments
 (0)