From 14374e62530bfd3ab5776e7142f8b78a1db7f05f Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 10 Dec 2015 20:00:52 -0800 Subject: [PATCH] split tests by completions/quick info --- .../thisPredicateFunctionCompletions.ts | 80 ++++++++++++++++ ...s.ts => thisPredicateFunctionQuickInfo.ts} | 18 ---- .../thisPredicateMemberCompletions.ts | 95 +++++++++++++++++++ ...ers.ts => thisPredicateMemberQuickInfo.ts} | 22 +---- 4 files changed, 176 insertions(+), 39 deletions(-) create mode 100644 tests/cases/fourslash/thisPredicateFunctionCompletions.ts rename tests/cases/fourslash/{thisPredicateFunctions.ts => thisPredicateFunctionQuickInfo.ts} (77%) create mode 100644 tests/cases/fourslash/thisPredicateMemberCompletions.ts rename tests/cases/fourslash/{thisPredicateMembers.ts => thisPredicateMemberQuickInfo.ts} (82%) diff --git a/tests/cases/fourslash/thisPredicateFunctionCompletions.ts b/tests/cases/fourslash/thisPredicateFunctionCompletions.ts new file mode 100644 index 00000000000..3c93a859bf3 --- /dev/null +++ b/tests/cases/fourslash/thisPredicateFunctionCompletions.ts @@ -0,0 +1,80 @@ +/// + +//// class RoyalGuard { +//// isLeader(): this is LeadGuard { +//// return this instanceof LeadGuard; +//// } +//// isFollower(): this is FollowerGuard { +//// return this instanceof FollowerGuard; +//// } +//// } +//// +//// class LeadGuard extends RoyalGuard { +//// lead(): void {}; +//// } +//// +//// class FollowerGuard extends RoyalGuard { +//// follow(): void {}; +//// } +//// +//// let a: RoyalGuard = new FollowerGuard(); +//// if (a.is/*1*/Leader()) { +//// a./*2*/; +//// } +//// else if (a.is/*3*/Follower()) { +//// a./*4*/; +//// } +//// +//// interface GuardInterface { +//// isLeader(): this is LeadGuard; +//// isFollower(): this is FollowerGuard; +//// } +//// +//// let b: GuardInterface; +//// if (b.is/*5*/Leader()) { +//// b./*6*/; +//// } +//// else if (b.is/*7*/Follower()) { +//// b./*8*/; +//// } +//// +//// if (((a.isLeader)())) { +//// a./*9*/; +//// } +//// else if (((a).isFollower())) { +//// a./*10*/; +//// } +//// +//// if (((a["isLeader"])())) { +//// a./*11*/; +//// } +//// else if (((a)["isFollower"]())) { +//// a./*12*/; +//// } +//// +//// let leader/*13*/Status = a.isLeader(); +//// function isLeaderGuard(g: RoyalGuard) { +//// return g.isLeader(); +//// } +//// let checked/*14*/LeaderStatus = isLeader/*15*/Guard(a); + + +goTo.marker("2"); +verify.completionListContains("lead"); +goTo.marker("4"); +verify.completionListContains("follow"); + +goTo.marker("6"); +verify.completionListContains("lead"); +goTo.marker("8"); +verify.completionListContains("follow"); + +goTo.marker("9"); +verify.completionListContains("lead"); +goTo.marker("10"); +verify.completionListContains("follow"); + +goTo.marker("11"); +verify.completionListContains("lead"); +goTo.marker("12"); +verify.completionListContains("follow"); \ No newline at end of file diff --git a/tests/cases/fourslash/thisPredicateFunctions.ts b/tests/cases/fourslash/thisPredicateFunctionQuickInfo.ts similarity index 77% rename from tests/cases/fourslash/thisPredicateFunctions.ts rename to tests/cases/fourslash/thisPredicateFunctionQuickInfo.ts index 8df03ea312a..3b7adc460c5 100644 --- a/tests/cases/fourslash/thisPredicateFunctions.ts +++ b/tests/cases/fourslash/thisPredicateFunctionQuickInfo.ts @@ -61,31 +61,13 @@ goTo.marker("1"); verify.quickInfoIs("(method) RoyalGuard.isLeader(): this is LeadGuard"); -goTo.marker("2"); -verify.completionListContains("lead"); goTo.marker("3"); verify.quickInfoIs("(method) RoyalGuard.isFollower(): this is FollowerGuard"); -goTo.marker("4"); -verify.completionListContains("follow"); goTo.marker("5"); verify.quickInfoIs("(method) GuardInterface.isLeader(): this is LeadGuard"); -goTo.marker("6"); -verify.completionListContains("lead"); goTo.marker("7"); verify.quickInfoIs("(method) GuardInterface.isFollower(): this is FollowerGuard"); -goTo.marker("8"); -verify.completionListContains("follow"); - -goTo.marker("9"); -verify.completionListContains("lead"); -goTo.marker("10"); -verify.completionListContains("follow"); - -goTo.marker("11"); -verify.completionListContains("lead"); -goTo.marker("12"); -verify.completionListContains("follow"); goTo.marker("13"); verify.quickInfoIs("let leaderStatus: boolean"); diff --git a/tests/cases/fourslash/thisPredicateMemberCompletions.ts b/tests/cases/fourslash/thisPredicateMemberCompletions.ts new file mode 100644 index 00000000000..609ed248644 --- /dev/null +++ b/tests/cases/fourslash/thisPredicateMemberCompletions.ts @@ -0,0 +1,95 @@ +/// + +//// class FileSystemObject { +//// get is/*1*/File(): this is Item { +//// return this instanceof Item; +//// } +//// set is/*2*/File(param) { +//// // noop +//// } +//// get is/*3*/Directory(): this is Directory { +//// return this instanceof Directory; +//// } +//// is/*4*/Networked: this is (Networked & this); +//// constructor(public path: string) {} +//// } +//// +//// class Item extends FileSystemObject { +//// constructor(path: string, public content: string) { super(path); } +//// } +//// class Directory extends FileSystemObject { +//// children: FileSystemObject[]; +//// } +//// interface Networked { +//// host: string; +//// } +//// +//// interface Sundries { +//// broken: boolean; +//// } +//// +//// interface Supplies { +//// spoiled: boolean; +//// } +//// +//// interface Crate { +//// contents: T; +//// is/*5*/Sundries: this is Crate; +//// is/*6*/Supplies: this is Crate; +//// is/*7*/PackedTight: this is (this & {extraContents: T}); +//// } +//// +//// const obj: FileSystemObject = new Item("/foo", ""); +//// if (obj.is/*8*/File) { +//// obj./*9*/; +//// if (obj.is/*10*/Networked) { +//// obj./*11*/; +//// } +//// } +//// if (obj.is/*12*/Directory) { +//// obj./*13*/; +//// if (obj.is/*14*/Networked) { +//// obj./*15*/; +//// } +//// } +//// if (obj.is/*16*/Networked) { +//// obj./*17*/; +//// } +//// +//// const crate: Crate; +//// if (crate.is/*18*/PackedTight) { +//// crate./*19*/; +//// } +//// if (crate.is/*20*/Sundries) { +//// crate.contents./*21*/; +//// if (crate.is/*22*/PackedTight) { +//// crate./*23*/ +//// } +//// } +//// if (crate.is/*24*/Supplies) { +//// crate.contents./*25*/; +//// if (crate.is/*26*/PackedTight) { +//// crate./*27*/ +//// } +//// } + +goTo.marker("9"); +verify.completionListContains("content"); +goTo.marker("11"); +verify.completionListContains("host"); +goTo.marker("13"); +verify.completionListContains("children"); +goTo.marker("15"); +verify.completionListContains("host"); +goTo.marker("17"); +verify.completionListContains("host"); +goTo.marker("19"); +verify.completionListContains("extraContents"); +goTo.marker("21"); +verify.completionListContains("broken"); +goTo.marker("23"); +verify.completionListContains("extraContents"); +goTo.marker("25"); +verify.completionListContains("spoiled"); +goTo.marker("27"); +verify.completionListContains("extraContents"); \ No newline at end of file diff --git a/tests/cases/fourslash/thisPredicateMembers.ts b/tests/cases/fourslash/thisPredicateMemberQuickInfo.ts similarity index 82% rename from tests/cases/fourslash/thisPredicateMembers.ts rename to tests/cases/fourslash/thisPredicateMemberQuickInfo.ts index b20a0de1997..dd596743902 100644 --- a/tests/cases/fourslash/thisPredicateMembers.ts +++ b/tests/cases/fourslash/thisPredicateMemberQuickInfo.ts @@ -91,47 +91,27 @@ verify.quickInfoIs(`(property) Crate.isPackedTight: this is this & { }`); goTo.marker("8"); verify.quickInfoIs("(property) FileSystemObject.isFile: this is Item"); -goTo.marker("9"); -verify.completionListContains("content"); goTo.marker("10"); verify.quickInfoIs("(property) FileSystemObject.isNetworked: this is Networked & Item"); -goTo.marker("11"); -verify.completionListContains("host"); goTo.marker("12"); verify.quickInfoIs("(property) FileSystemObject.isDirectory: this is Directory"); -goTo.marker("13"); -verify.completionListContains("children"); goTo.marker("14"); verify.quickInfoIs("(property) FileSystemObject.isNetworked: this is Networked & Directory"); -goTo.marker("15"); -verify.completionListContains("host"); goTo.marker("16"); verify.quickInfoIs("(property) FileSystemObject.isNetworked: this is Networked & FileSystemObject"); -goTo.marker("17"); -verify.completionListContains("host"); goTo.marker("18"); verify.quickInfoIs(`(property) Crate.isPackedTight: this is Crate & { extraContents: any; }`); -goTo.marker("19"); -verify.completionListContains("extraContents"); goTo.marker("20"); verify.quickInfoIs("(property) Crate.isSundries: this is Crate"); -goTo.marker("21"); -verify.completionListContains("broken"); goTo.marker("22"); verify.quickInfoIs(`(property) Crate.isPackedTight: this is Crate & { extraContents: Sundries; }`); -goTo.marker("23"); -verify.completionListContains("extraContents"); goTo.marker("24"); verify.quickInfoIs("(property) Crate.isSupplies: this is Crate"); -goTo.marker("25"); -verify.completionListContains("spoiled"); goTo.marker("26"); verify.quickInfoIs(`(property) Crate.isPackedTight: this is Crate & { extraContents: Supplies; -}`); -goTo.marker("27"); -verify.completionListContains("extraContents"); \ No newline at end of file +}`); \ No newline at end of file