Skip to content

Commit 3c99527

Browse files
committed
Add tests for __metadata and __param
1 parent 101aedb commit 3c99527

File tree

5 files changed

+50
-6
lines changed

5 files changed

+50
-6
lines changed

src/harness/harness.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,8 +990,12 @@ module Harness {
990990
}
991991
break;
992992

993+
case 'emitdecoratormetadata':
994+
options.emitDecoratorMetadata = setting.value === 'true';
995+
break;
996+
993997
case 'noemithelpers':
994-
options.noEmitHelpers = !!setting.value;
998+
options.noEmitHelpers = setting.value === 'true';
995999
break;
9961000

9971001
case 'noemitonerror':
@@ -1486,7 +1490,7 @@ module Harness {
14861490
"errortruncation", "usecasesensitivefilenames", "preserveconstenums",
14871491
"includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal",
14881492
"separatecompilation", "inlinesourcemap", "maproot", "sourceroot",
1489-
"inlinesources"];
1493+
"inlinesources", "emitdecoratormetadata"];
14901494

14911495
function extractCompilerSettings(content: string): CompilerSetting[] {
14921496

tests/baselines/reference/noEmitHelpers2.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@
33
function decorator() { }
44

55
@decorator
6-
class A { }
6+
class A {
7+
constructor(a: number, @decorator b: string) {
8+
}
9+
}
710

811
//// [noEmitHelpers2.js]
912
function decorator() { }
1013
var A = (function () {
11-
function A() {
14+
function A(a, b) {
1215
}
1316
A = __decorate([
14-
decorator
17+
decorator,
18+
__param(1, decorator),
19+
__metadata('design:paramtypes', [Number, String])
1520
], A);
1621
return A;
1722
})();
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== tests/cases/compiler/noEmitHelpers2.ts ===
2+
3+
function decorator() { }
4+
>decorator : Symbol(decorator, Decl(noEmitHelpers2.ts, 0, 0))
5+
6+
@decorator
7+
>decorator : Symbol(decorator, Decl(noEmitHelpers2.ts, 0, 0))
8+
9+
class A {
10+
>A : Symbol(A, Decl(noEmitHelpers2.ts, 1, 24))
11+
12+
constructor(a: number, @decorator b: string) {
13+
>a : Symbol(a, Decl(noEmitHelpers2.ts, 5, 16))
14+
>decorator : Symbol(decorator, Decl(noEmitHelpers2.ts, 0, 0))
15+
>b : Symbol(b, Decl(noEmitHelpers2.ts, 5, 26))
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== tests/cases/compiler/noEmitHelpers2.ts ===
2+
3+
function decorator() { }
4+
>decorator : () => void
5+
6+
@decorator
7+
>decorator : () => void
8+
9+
class A {
10+
>A : A
11+
12+
constructor(a: number, @decorator b: string) {
13+
>a : number
14+
>decorator : () => void
15+
>b : string
16+
}
17+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// @noemithelpers: true
2+
// @emitdecoratormetadata: true
23
// @target: es5
34

45
function decorator() { }
56

67
@decorator
78
class A {
8-
constructor(a: number, b: string) {
9+
constructor(a: number, @decorator b: string) {
910
}
1011
}

0 commit comments

Comments
 (0)