mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add tests
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
//// [modifierOnClassDeclarationMemberInFunction.ts]
|
||||
|
||||
function f() {
|
||||
class C {
|
||||
public baz = 1;
|
||||
static foo() { }
|
||||
public bar() { }
|
||||
}
|
||||
}
|
||||
|
||||
//// [modifierOnClassDeclarationMemberInFunction.js]
|
||||
function f() {
|
||||
var C = (function () {
|
||||
function C() {
|
||||
this.baz = 1;
|
||||
}
|
||||
C.foo = function () { };
|
||||
C.prototype.bar = function () { };
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
|
||||
|
||||
//// [modifierOnClassDeclarationMemberInFunction.d.ts]
|
||||
declare function f(): void;
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/conformance/classes/classDeclarations/modifierOnClassDeclarationMemberInFunction.ts ===
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(modifierOnClassDeclarationMemberInFunction.ts, 0, 0))
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(modifierOnClassDeclarationMemberInFunction.ts, 1, 14))
|
||||
|
||||
public baz = 1;
|
||||
>baz : Symbol(baz, Decl(modifierOnClassDeclarationMemberInFunction.ts, 2, 13))
|
||||
|
||||
static foo() { }
|
||||
>foo : Symbol(C.foo, Decl(modifierOnClassDeclarationMemberInFunction.ts, 3, 23))
|
||||
|
||||
public bar() { }
|
||||
>bar : Symbol(bar, Decl(modifierOnClassDeclarationMemberInFunction.ts, 4, 24))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/classes/classDeclarations/modifierOnClassDeclarationMemberInFunction.ts ===
|
||||
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
public baz = 1;
|
||||
>baz : number
|
||||
>1 : number
|
||||
|
||||
static foo() { }
|
||||
>foo : () => void
|
||||
|
||||
public bar() { }
|
||||
>bar : () => void
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//// [modifierOnClassExpressionMemberInFunction.ts]
|
||||
|
||||
function g() {
|
||||
var x = class C {
|
||||
public prop1 = 1;
|
||||
private foo() { }
|
||||
static prop2 = 43;
|
||||
}
|
||||
}
|
||||
|
||||
//// [modifierOnClassExpressionMemberInFunction.js]
|
||||
function g() {
|
||||
var x = (function () {
|
||||
function C() {
|
||||
this.prop1 = 1;
|
||||
}
|
||||
C.prototype.foo = function () { };
|
||||
C.prop2 = 43;
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
|
||||
|
||||
//// [modifierOnClassExpressionMemberInFunction.d.ts]
|
||||
declare function g(): void;
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/classes/classExpressions/modifierOnClassExpressionMemberInFunction.ts ===
|
||||
|
||||
function g() {
|
||||
>g : Symbol(g, Decl(modifierOnClassExpressionMemberInFunction.ts, 0, 0))
|
||||
|
||||
var x = class C {
|
||||
>x : Symbol(x, Decl(modifierOnClassExpressionMemberInFunction.ts, 2, 7))
|
||||
>C : Symbol(C, Decl(modifierOnClassExpressionMemberInFunction.ts, 2, 11))
|
||||
|
||||
public prop1 = 1;
|
||||
>prop1 : Symbol(C.prop1, Decl(modifierOnClassExpressionMemberInFunction.ts, 2, 21))
|
||||
|
||||
private foo() { }
|
||||
>foo : Symbol(C.foo, Decl(modifierOnClassExpressionMemberInFunction.ts, 3, 25))
|
||||
|
||||
static prop2 = 43;
|
||||
>prop2 : Symbol(C.prop2, Decl(modifierOnClassExpressionMemberInFunction.ts, 4, 25))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/conformance/classes/classExpressions/modifierOnClassExpressionMemberInFunction.ts ===
|
||||
|
||||
function g() {
|
||||
>g : () => void
|
||||
|
||||
var x = class C {
|
||||
>x : typeof C
|
||||
>class C { public prop1 = 1; private foo() { } static prop2 = 43; } : typeof C
|
||||
>C : typeof C
|
||||
|
||||
public prop1 = 1;
|
||||
>prop1 : number
|
||||
>1 : number
|
||||
|
||||
private foo() { }
|
||||
>foo : () => void
|
||||
|
||||
static prop2 = 43;
|
||||
>prop2 : number
|
||||
>43 : number
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// @declaration: true
|
||||
|
||||
function f() {
|
||||
class C {
|
||||
public baz = 1;
|
||||
static foo() { }
|
||||
public bar() { }
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// @declaration: true
|
||||
// @declaration: true
|
||||
|
||||
function g() {
|
||||
var x = class C {
|
||||
public prop1 = 1;
|
||||
private foo() { }
|
||||
static prop2 = 43;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user