Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update fourslash tests to have semicolons
  • Loading branch information
andrewbranch committed Jun 6, 2019
commit ca44ee8f975b32d275a7f6470f2232fc68cbc8a5
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference path='fourslash.ts' />

////export default function() {
//// /*start*/0/*end*/
//// /*start*/0/*end*/;
////}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, these are all tests which use the writer's heuristic for semis - and they all now get the semi because it doesn't have proof that the file isn't using them. Makes sense.


goTo.select('start', 'end')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "constant_scope_0",
actionDescription: "Extract to constant in enclosing scope",
newContent: "const /*RENAME*/newLocal = <div></div>;",
newContent: "const /*RENAME*/newLocal = <div></div>",
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType11.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference path='fourslash.ts' />

//// function foo(a: number, b?: number, ...c: number[]): boolean {
//// return false as /*a*/boolean/*b*/
//// return false as /*a*/boolean/*b*/;
//// }

goTo.select("a", "b");
Expand All @@ -12,6 +12,6 @@ edit.applyRefactor({
newContent: `function foo(a: number, b?: number, ...c: number[]): boolean {
type /*RENAME*/NewType = boolean;

return false as NewType
return false as NewType;
}`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType14.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<T = /*a*/boolean/*b*/> = string | number | T
//// type A<T = /*a*/boolean/*b*/> = string | number | T;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType = boolean;

type A<T = NewType> = string | number | T`,
type A<T = NewType> = string | number | T;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType15.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<T = boolean> = /*a*/string/*b*/ | number | T
//// type A<T = boolean> = /*a*/string/*b*/ | number | T;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType = string;

type A<T = boolean> = NewType | number | T`,
type A<T = boolean> = NewType | number | T;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType17.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<T = boolean> = string | number | /*a*/T/*b*/
//// type A<T = boolean> = string | number | /*a*/T/*b*/;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<T> = T;

type A<T = boolean> = string | number | NewType<T>`,
type A<T = boolean> = string | number | NewType<T>;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType18.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<B, C, D = B> = /*a*/Partial<C | string>/*b*/ & D | C
//// type A<B, C, D = B> = /*a*/Partial<C | string>/*b*/ & D | C;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,6 +9,6 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<C> = Partial<C | string>;

type A<B, C, D = B> = NewType<C> & D | C`,
type A<B, C, D = B> = NewType<C> & D | C;`,
});

4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType19.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<B, C, D = B> = /*a*/Partial<C | string | D>/*b*/ & D | C
//// type A<B, C, D = B> = /*a*/Partial<C | string | D>/*b*/ & D | C;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,6 +9,6 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<C, D> = Partial<C | string | D>;

type A<B, C, D = B> = NewType<C, D> & D | C`,
type A<B, C, D = B> = NewType<C, D> & D | C;`,
});

4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType20.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<T, U> = () => <T>(v: /*a*/T/*b*/) => (v: T) => <T>(v: T) => U
//// type A<T, U> = () => <T>(v: /*a*/T/*b*/) => (v: T) => <T>(v: T) => U;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<T> = T;

type A<T, U> = () => <T>(v: NewType<T>) => (v: T) => <T>(v: T) => U`,
type A<T, U> = () => <T>(v: NewType<T>) => (v: T) => <T>(v: T) => U;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType21.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<T, U> = () => <T>(v: T) => (v: /*a*/T/*b*/) => <T>(v: T) => U
//// type A<T, U> = () => <T>(v: T) => (v: /*a*/T/*b*/) => <T>(v: T) => U;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<T> = T;

type A<T, U> = () => <T>(v: T) => (v: NewType<T>) => <T>(v: T) => U`,
type A<T, U> = () => <T>(v: T) => (v: NewType<T>) => <T>(v: T) => U;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType22.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<T, U> = () => <T>(v: T) => (v: T) => <T>(v: /*a*/T/*b*/) => U
//// type A<T, U> = () => <T>(v: T) => (v: T) => <T>(v: /*a*/T/*b*/) => U;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<T> = T;

type A<T, U> = () => <T>(v: T) => (v: T) => <T>(v: NewType<T>) => U`,
type A<T, U> = () => <T>(v: T) => (v: T) => <T>(v: NewType<T>) => U;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType23.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<T, U> = () => <T>(v: T) => (v: T) => <T>(v: T) => /*a*/U/*b*/
//// type A<T, U> = () => <T>(v: T) => (v: T) => <T>(v: T) => /*a*/U/*b*/;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<U> = U;

type A<T, U> = () => <T>(v: T) => (v: T) => <T>(v: T) => NewType<U>`,
type A<T, U> = () => <T>(v: T) => (v: T) => <T>(v: T) => NewType<U>;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType24.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<T, U> = () => <T>(v: T) => (v: T) => /*a*/<T>(v: T) => U/*b*/
//// type A<T, U> = () => <T>(v: T) => (v: T) => /*a*/<T>(v: T) => U/*b*/;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<U> = <T>(v: T) => U;

type A<T, U> = () => <T>(v: T) => (v: T) => NewType<U>`,
type A<T, U> = () => <T>(v: T) => (v: T) => NewType<U>;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType25.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<T, U> = () => <T>(v: T) => /*a*/(v: T) => <T>(v: T) => U/*b*/
//// type A<T, U> = () => <T>(v: T) => /*a*/(v: T) => <T>(v: T) => U/*b*/;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<T, U> = (v: T) => <T>(v: T) => U;

type A<T, U> = () => <T>(v: T) => NewType<T, U>`,
type A<T, U> = () => <T>(v: T) => NewType<T, U>;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType26.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<T, U> = () => /*a*/<T>(v: T) => (v: T) => <T>(v: T) => U/*b*/
//// type A<T, U> = () => /*a*/<T>(v: T) => (v: T) => <T>(v: T) => U/*b*/;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<U> = <T>(v: T) => (v: T) => <T>(v: T) => U;

type A<T, U> = () => NewType<U>`,
type A<T, U> = () => NewType<U>;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType27.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<T, U> = /*a*/() => <T>(v: T) => (v: T) => <T>(v: T) => U/*b*/
//// type A<T, U> = /*a*/() => <T>(v: T) => (v: T) => <T>(v: T) => U/*b*/;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<U> = () => <T>(v: T) => (v: T) => <T>(v: T) => U;

type A<T, U> = NewType<U>`,
type A<T, U> = NewType<U>;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType28.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type Item<T> = /*a*/T/*b*/ extends (infer P)[] ? P : never
//// type Item<T> = /*a*/T/*b*/ extends (infer P)[] ? P : never;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<T> = T;

type Item<T> = NewType<T> extends (infer P)[] ? P : never`,
type Item<T> = NewType<T> extends (infer P)[] ? P : never;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType29.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type Item<T> = T extends (infer P)[] ? /*a*/P/*b*/ : never
//// type Item<T> = T extends (infer P)[] ? /*a*/P/*b*/ : never;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<P> = P;

type Item<T> = T extends (infer P)[] ? NewType<P> : never`,
type Item<T> = T extends (infer P)[] ? NewType<P> : never;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType30.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type Item<T> = T extends (infer P)[] ? P : /*a*/never/*b*/
//// type Item<T> = T extends (infer P)[] ? P : /*a*/never/*b*/;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType = never;

type Item<T> = T extends (infer P)[] ? P : NewType`,
type Item<T> = T extends (infer P)[] ? P : NewType;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType34.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type Item<T> = /*a*/T extends (infer P)[] ? P : never/*b*/
//// type Item<T> = /*a*/T extends (infer P)[] ? P : never/*b*/;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<T> = T extends (infer P)[] ? P : never;

type Item<T> = NewType<T>`,
type Item<T> = NewType<T>;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType35.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type Union<T, U> = /*a*/U | T/*b*/
//// type Union<T, U> = /*a*/U | T/*b*/;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<U, T> = U | T;

type Union<T, U> = NewType<U, T>`,
type Union<T, U> = NewType<U, T>;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType36.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A = (v: /*a*/string | number/*b*/) => v is string
//// type A = (v: /*a*/string | number/*b*/) => v is string;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,6 +9,6 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType = string | number;

type A = (v: NewType) => v is string`,
type A = (v: NewType) => v is string;`,
});

4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType37.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A = (v: string | number) => v is /*a*/string/*b*/
//// type A = (v: string | number) => v is /*a*/string/*b*/;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType = string;

type A = (v: string | number) => v is NewType`,
type A = (v: string | number) => v is NewType;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType39.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A = /*a*/(v: string | number) => v is string/*b*/
//// type A = /*a*/(v: string | number) => v is string/*b*/;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType = (v: string | number) => v is string;

type A = NewType`,
type A = NewType;`,
});
8 changes: 4 additions & 4 deletions tests/cases/fourslash/refactorExtractType42.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/// <reference path='fourslash.ts' />

//// const a = 1
//// type A = (v: string | number) => /*a*/typeof a/*b*/
//// const a = 1;
//// type A = (v: string | number) => /*a*/typeof a/*b*/;

goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `const a = 1
newContent: `const a = 1;
type /*RENAME*/NewType = typeof a;

type A = (v: string | number) => NewType`,
type A = (v: string | number) => NewType;`,
});
4 changes: 2 additions & 2 deletions tests/cases/fourslash/refactorExtractType44.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path='fourslash.ts' />

//// type A<T> = /*a*/B.C.D<T>/*b*/
//// type A<T> = /*a*/B.C.D<T>/*b*/;

goTo.select("a", "b");
edit.applyRefactor({
Expand All @@ -9,5 +9,5 @@ edit.applyRefactor({
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<T> = B.C.D<T>;

type A<T> = NewType<T>`,
type A<T> = NewType<T>;`,
});
Loading