Adding testcase for extends helper emit when generating system module

Testcase for #3655
This commit is contained in:
Sheetal Nandi 2015-07-30 12:01:21 -07:00
parent 7e9e920d1e
commit cd018e1af4
4 changed files with 107 additions and 0 deletions

View file

@ -0,0 +1,55 @@
//// [tests/cases/compiler/systemModuleWithSuperClass.ts] ////
//// [foo.ts]
export class Foo {
a: string;
}
//// [bar.ts]
import {Foo} from './foo';
export class Bar extends Foo {
b: string;
}
//// [foo.js]
System.register([], function(exports_1) {
var Foo;
return {
setters:[],
execute: function() {
Foo = (function () {
function Foo() {
}
return Foo;
})();
exports_1("Foo", Foo);
}
}
});
//// [bar.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
System.register(['./foo'], function(exports_1) {
var foo_1;
var Bar;
return {
setters:[
function (_foo_1) {
foo_1 = _foo_1;
}],
execute: function() {
Bar = (function (_super) {
__extends(Bar, _super);
function Bar() {
_super.apply(this, arguments);
}
return Bar;
})(foo_1.Foo);
exports_1("Bar", Bar);
}
}
});

View file

@ -0,0 +1,20 @@
=== tests/cases/compiler/foo.ts ===
export class Foo {
>Foo : Symbol(Foo, Decl(foo.ts, 0, 0))
a: string;
>a : Symbol(a, Decl(foo.ts, 1, 18))
}
=== tests/cases/compiler/bar.ts ===
import {Foo} from './foo';
>Foo : Symbol(Foo, Decl(bar.ts, 0, 8))
export class Bar extends Foo {
>Bar : Symbol(Bar, Decl(bar.ts, 0, 26))
>Foo : Symbol(Foo, Decl(bar.ts, 0, 8))
b: string;
>b : Symbol(b, Decl(bar.ts, 1, 30))
}

View file

@ -0,0 +1,20 @@
=== tests/cases/compiler/foo.ts ===
export class Foo {
>Foo : Foo
a: string;
>a : string
}
=== tests/cases/compiler/bar.ts ===
import {Foo} from './foo';
>Foo : typeof Foo
export class Bar extends Foo {
>Bar : Bar
>Foo : Foo
b: string;
>b : string
}

View file

@ -0,0 +1,12 @@
// @module: system
// @Filename: foo.ts
export class Foo {
a: string;
}
// @Filename: bar.ts
import {Foo} from './foo';
export class Bar extends Foo {
b: string;
}