Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Ozga committed Feb 16, 2017
1 parent f133a67 commit 150e2fb
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 6 deletions.
22 changes: 22 additions & 0 deletions tests/cases/fourslash/codeFixUndeclaredClassInstance.ts
@@ -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);
Expand Up @@ -14,4 +14,4 @@ class A {
this.x = 10;
}
}
`);
`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
Expand Up @@ -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);
2 changes: 1 addition & 1 deletion tests/cases/fourslash/fourslash.ts
Expand Up @@ -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;
Expand Down

0 comments on commit 150e2fb

Please sign in to comment.