Skip to content

Commit 9344bd0

Browse files
author
Yui T
committed
Add tests
1 parent 48ae5ea commit 9344bd0

8 files changed

+147
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//// [modifierOnClassDeclarationMemberInFunction.ts]
2+
3+
function f() {
4+
class C {
5+
public baz = 1;
6+
static foo() { }
7+
public bar() { }
8+
}
9+
}
10+
11+
//// [modifierOnClassDeclarationMemberInFunction.js]
12+
function f() {
13+
var C = (function () {
14+
function C() {
15+
this.baz = 1;
16+
}
17+
C.foo = function () { };
18+
C.prototype.bar = function () { };
19+
return C;
20+
})();
21+
}
22+
23+
24+
//// [modifierOnClassDeclarationMemberInFunction.d.ts]
25+
declare function f(): void;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
=== tests/cases/conformance/classes/classDeclarations/modifierOnClassDeclarationMemberInFunction.ts ===
2+
3+
function f() {
4+
>f : Symbol(f, Decl(modifierOnClassDeclarationMemberInFunction.ts, 0, 0))
5+
6+
class C {
7+
>C : Symbol(C, Decl(modifierOnClassDeclarationMemberInFunction.ts, 1, 14))
8+
9+
public baz = 1;
10+
>baz : Symbol(baz, Decl(modifierOnClassDeclarationMemberInFunction.ts, 2, 13))
11+
12+
static foo() { }
13+
>foo : Symbol(C.foo, Decl(modifierOnClassDeclarationMemberInFunction.ts, 3, 23))
14+
15+
public bar() { }
16+
>bar : Symbol(bar, Decl(modifierOnClassDeclarationMemberInFunction.ts, 4, 24))
17+
}
18+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
=== tests/cases/conformance/classes/classDeclarations/modifierOnClassDeclarationMemberInFunction.ts ===
2+
3+
function f() {
4+
>f : () => void
5+
6+
class C {
7+
>C : C
8+
9+
public baz = 1;
10+
>baz : number
11+
>1 : number
12+
13+
static foo() { }
14+
>foo : () => void
15+
16+
public bar() { }
17+
>bar : () => void
18+
}
19+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//// [modifierOnClassExpressionMemberInFunction.ts]
2+
3+
function g() {
4+
var x = class C {
5+
public prop1 = 1;
6+
private foo() { }
7+
static prop2 = 43;
8+
}
9+
}
10+
11+
//// [modifierOnClassExpressionMemberInFunction.js]
12+
function g() {
13+
var x = (function () {
14+
function C() {
15+
this.prop1 = 1;
16+
}
17+
C.prototype.foo = function () { };
18+
C.prop2 = 43;
19+
return C;
20+
})();
21+
}
22+
23+
24+
//// [modifierOnClassExpressionMemberInFunction.d.ts]
25+
declare function g(): void;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
=== tests/cases/conformance/classes/classExpressions/modifierOnClassExpressionMemberInFunction.ts ===
2+
3+
function g() {
4+
>g : Symbol(g, Decl(modifierOnClassExpressionMemberInFunction.ts, 0, 0))
5+
6+
var x = class C {
7+
>x : Symbol(x, Decl(modifierOnClassExpressionMemberInFunction.ts, 2, 7))
8+
>C : Symbol(C, Decl(modifierOnClassExpressionMemberInFunction.ts, 2, 11))
9+
10+
public prop1 = 1;
11+
>prop1 : Symbol(C.prop1, Decl(modifierOnClassExpressionMemberInFunction.ts, 2, 21))
12+
13+
private foo() { }
14+
>foo : Symbol(C.foo, Decl(modifierOnClassExpressionMemberInFunction.ts, 3, 25))
15+
16+
static prop2 = 43;
17+
>prop2 : Symbol(C.prop2, Decl(modifierOnClassExpressionMemberInFunction.ts, 4, 25))
18+
}
19+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
=== tests/cases/conformance/classes/classExpressions/modifierOnClassExpressionMemberInFunction.ts ===
2+
3+
function g() {
4+
>g : () => void
5+
6+
var x = class C {
7+
>x : typeof C
8+
>class C { public prop1 = 1; private foo() { } static prop2 = 43; } : typeof C
9+
>C : typeof C
10+
11+
public prop1 = 1;
12+
>prop1 : number
13+
>1 : number
14+
15+
private foo() { }
16+
>foo : () => void
17+
18+
static prop2 = 43;
19+
>prop2 : number
20+
>43 : number
21+
}
22+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @declaration: true
2+
3+
function f() {
4+
class C {
5+
public baz = 1;
6+
static foo() { }
7+
public bar() { }
8+
}
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @declaration: true
2+
// @declaration: true
3+
4+
function g() {
5+
var x = class C {
6+
public prop1 = 1;
7+
private foo() { }
8+
static prop2 = 43;
9+
}
10+
}

0 commit comments

Comments
 (0)