add tests
This commit is contained in:
parent
f19c3121c2
commit
c125f080a4
34
tests/cases/fourslash/codeFixUndeclaredAcrossFiles1.ts
Normal file
34
tests/cases/fourslash/codeFixUndeclaredAcrossFiles1.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
|
||||
// @Filename: f2.js
|
||||
//// import * as X from "./f1";
|
||||
//// X.C.m0(1, "", []);
|
||||
//// X.C.x;
|
||||
//// let c = new X.C;
|
||||
//// c.m1();
|
||||
//// c.y = {};
|
||||
|
||||
// @Filename: f1.ts
|
||||
//// export class C {[|
|
||||
//// |]x: number;
|
||||
//// static y: string;
|
||||
//// }
|
||||
|
||||
verify.applyCodeFix(/*errorCode*/undefined, 0);
|
||||
verify.applyCodeFix(/*errorCode*/undefined, 0);
|
||||
verify.applyCodeFix(/*errorCode*/undefined, 0);
|
||||
verify.applyCodeFix(/*errorCode*/undefined, 0);
|
||||
|
||||
verify.rangeIs(`
|
||||
y: { [x: string]: any; };
|
||||
m1(): any {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
static x: any;
|
||||
static m0(arg0: any, arg1: any, arg2: any): any {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
`);
|
40
tests/cases/fourslash/codeFixUndeclaredAcrossFiles2.ts
Normal file
40
tests/cases/fourslash/codeFixUndeclaredAcrossFiles2.ts
Normal file
|
@ -0,0 +1,40 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
|
||||
// @Filename: f2.ts
|
||||
//// import * as X from "./f1";
|
||||
//// X.C.m0(1, "", []);
|
||||
//// X.C.x;
|
||||
//// let c = new X.C;
|
||||
//// c.m1();
|
||||
//// c.y = {};
|
||||
|
||||
// @Filename: f1.js
|
||||
//// [|export class C {
|
||||
//// x: number;
|
||||
//// static y: string;
|
||||
//// constructor() { }
|
||||
//// }|]
|
||||
|
||||
verify.applyCodeFix(/*errorCode*/undefined, 0);
|
||||
verify.applyCodeFix(/*errorCode*/undefined, 0);
|
||||
verify.applyCodeFix(/*errorCode*/undefined, 0);
|
||||
verify.applyCodeFix(/*errorCode*/undefined, 0);
|
||||
|
||||
verify.rangeIs(`
|
||||
export class C {
|
||||
m1() {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
static m0(arg0, arg1, arg2) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
x: number;
|
||||
static y: string;
|
||||
constructor() {
|
||||
this.y = undefined;
|
||||
}
|
||||
}
|
||||
`);
|
44
tests/cases/fourslash/codeFixUndeclaredInStaticMethod.ts
Normal file
44
tests/cases/fourslash/codeFixUndeclaredInStaticMethod.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {[|
|
||||
//// |]static foo0() {
|
||||
//// this.m1(1,2,3);
|
||||
//// A.m2(1,2);
|
||||
//// this.prop1 = 10;
|
||||
//// A.prop2 = "asdf";
|
||||
//// }
|
||||
//// }
|
||||
|
||||
verify.applyCodeFix(/*errorCode*/undefined, 0);
|
||||
verify.applyCodeFix(/*errorCode*/undefined, 0);
|
||||
verify.applyCodeFix(/*errorCode*/undefined, 0);
|
||||
verify.applyCodeFix(/*errorCode*/undefined, 0);
|
||||
|
||||
verify.rangeIs(`
|
||||
static prop2: string;
|
||||
static prop1: number;
|
||||
static m2(arg0: any, arg1: any): any {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
static m1(arg0: any, arg1: any, arg2: any): any {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
`);
|
||||
|
||||
// class A {
|
||||
// static prop2: string;
|
||||
// static prop1: number;
|
||||
// static m2(arg0: any, arg1: any): any {
|
||||
// throw new Error("Method not implemented.");
|
||||
// }
|
||||
// static m1(arg0: any, arg1: any, arg2: any): any {
|
||||
// throw new Error("Method not implemented.");
|
||||
// }
|
||||
// static foo0() {
|
||||
// this.m1(1,2,3);
|
||||
// A.m2(1,2);
|
||||
// this.prop1 = 10;
|
||||
// A.prop2 = "asdf";
|
||||
// }
|
||||
// }
|
||||
|
|
@ -15,13 +15,13 @@ verify.applyCodeFix(/*errorCode*/undefined, 0);
|
|||
verify.applyCodeFix(/*errorCode*/undefined, 0);
|
||||
|
||||
verify.rangeIs(`
|
||||
foo3<T0, T1, T2, T3, T4, T5, T6, T7>() {
|
||||
foo3<T0, T1, T2, T3, T4, T5, T6, T7>(): any {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
foo2<T, U, V, W, X, Y, Z>() {
|
||||
foo2<T, U, V, W, X, Y, Z>(): any {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
foo1(arg0: any, arg1: any, arg2: any) {
|
||||
foo1(arg0: any, arg1: any, arg2: any): any {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
`);
|
17
tests/cases/fourslash/codeFixUndeclaredPropertyAccesses.ts
Normal file
17
tests/cases/fourslash/codeFixUndeclaredPropertyAccesses.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// interface I { x: number; }
|
||||
//// let i: I;
|
||||
//// i.y;
|
||||
//// i.foo();
|
||||
//// enum E { a,b }
|
||||
//// let e: typeof E;
|
||||
//// e.a;
|
||||
//// e.c;
|
||||
//// let obj = { a: 1, b: "asdf"};
|
||||
//// obj.c;
|
||||
//// type T<U> = I | U;
|
||||
//// let t: T<number>;
|
||||
//// t.x;
|
||||
|
||||
verify.not.codeFixAvailable();
|
Loading…
Reference in a new issue