mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 01:39:28 -06:00
add tests
This commit is contained in:
parent
f133a6755e
commit
150e2fbf50
22
tests/cases/fourslash/codeFixUndeclaredClassInstance.ts
Normal file
22
tests/cases/fourslash/codeFixUndeclaredClassInstance.ts
Normal file
@ -0,0 +1,22 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A {
|
||||
//// a: number;
|
||||
//// b: string;
|
||||
//// constructor(public x: any) {}
|
||||
//// }
|
||||
//// [|class B {
|
||||
//// constructor() {
|
||||
//// this.x = new A(3);
|
||||
//// }
|
||||
//// }|]
|
||||
|
||||
verify.rangeAfterCodeFix(`
|
||||
class B {
|
||||
x: A;
|
||||
|
||||
constructor() {
|
||||
this.x = new A(3);
|
||||
}
|
||||
}
|
||||
`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
|
||||
@ -0,0 +1,22 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// class A<T> {
|
||||
//// a: number;
|
||||
//// b: string;
|
||||
//// constructor(public x: T) {}
|
||||
//// }
|
||||
//// [|class B {
|
||||
//// constructor() {
|
||||
//// this.x = new A(3);
|
||||
//// }
|
||||
//// }|]
|
||||
|
||||
verify.rangeAfterCodeFix(`
|
||||
class B {
|
||||
x: A<number>;
|
||||
|
||||
constructor() {
|
||||
this.x = new A(3);
|
||||
}
|
||||
}
|
||||
`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
|
||||
@ -14,4 +14,4 @@ class A {
|
||||
this.x = 10;
|
||||
}
|
||||
}
|
||||
`);
|
||||
`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
|
||||
@ -8,10 +8,10 @@
|
||||
|
||||
verify.rangeAfterCodeFix(`
|
||||
class A {
|
||||
x: { a: number, b: string };
|
||||
|
||||
x: { a: number; b: string; };
|
||||
|
||||
constructor() {
|
||||
this.x = 10;
|
||||
this.x = { a: 10, b: "hello" };
|
||||
}
|
||||
}
|
||||
`);
|
||||
`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
|
||||
@ -225,7 +225,7 @@ declare namespace FourSlashInterface {
|
||||
noMatchingBracePositionInCurrentFile(bracePosition: number): void;
|
||||
DocCommentTemplate(expectedText: string, expectedOffset: number, empty?: boolean): void;
|
||||
noDocCommentTemplate(): void;
|
||||
rangeAfterCodeFix(expectedText: string, includeWhiteSpace?: boolean, errorCode?: number): void;
|
||||
rangeAfterCodeFix(expectedText: string, includeWhiteSpace?: boolean, errorCode?: number, index?: number): void;
|
||||
importFixAtPosition(expectedTextArray: string[], errorCode?: number): void;
|
||||
|
||||
navigationBar(json: any): void;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user