Skip to content

Commit 150e2fb

Browse files
author
Arthur Ozga
committed
add tests
1 parent f133a67 commit 150e2fb

5 files changed

+50
-6
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// class A {
4+
//// a: number;
5+
//// b: string;
6+
//// constructor(public x: any) {}
7+
//// }
8+
//// [|class B {
9+
//// constructor() {
10+
//// this.x = new A(3);
11+
//// }
12+
//// }|]
13+
14+
verify.rangeAfterCodeFix(`
15+
class B {
16+
x: A;
17+
18+
constructor() {
19+
this.x = new A(3);
20+
}
21+
}
22+
`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// class A<T> {
4+
//// a: number;
5+
//// b: string;
6+
//// constructor(public x: T) {}
7+
//// }
8+
//// [|class B {
9+
//// constructor() {
10+
//// this.x = new A(3);
11+
//// }
12+
//// }|]
13+
14+
verify.rangeAfterCodeFix(`
15+
class B {
16+
x: A<number>;
17+
18+
constructor() {
19+
this.x = new A(3);
20+
}
21+
}
22+
`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);

tests/cases/fourslash/codeFixUndeclaredPropertyNumericLiteral.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ class A {
1414
this.x = 10;
1515
}
1616
}
17-
`);
17+
`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);

tests/cases/fourslash/codeFixUndeclaredPropertyObjectLiteral.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
verify.rangeAfterCodeFix(`
1010
class A {
11-
x: { a: number, b: string };
12-
11+
x: { a: number; b: string; };
12+
1313
constructor() {
14-
this.x = 10;
14+
this.x = { a: 10, b: "hello" };
1515
}
1616
}
17-
`);
17+
`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);

tests/cases/fourslash/fourslash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ declare namespace FourSlashInterface {
225225
noMatchingBracePositionInCurrentFile(bracePosition: number): void;
226226
DocCommentTemplate(expectedText: string, expectedOffset: number, empty?: boolean): void;
227227
noDocCommentTemplate(): void;
228-
rangeAfterCodeFix(expectedText: string, includeWhiteSpace?: boolean, errorCode?: number): void;
228+
rangeAfterCodeFix(expectedText: string, includeWhiteSpace?: boolean, errorCode?: number, index?: number): void;
229229
importFixAtPosition(expectedTextArray: string[], errorCode?: number): void;
230230

231231
navigationBar(json: any): void;

0 commit comments

Comments
 (0)