Skip to content

Commit f4f4720

Browse files
Fixed up fourslash tests to only test functions.
1 parent b7778c1 commit f4f4720

7 files changed

+211
-212
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//// class FileSystemObject {
4+
//// isFile(): this is Item {
5+
//// return this instanceof Item;
6+
//// }
7+
//// isDirectory(): this is Directory {
8+
//// return this instanceof Directory;
9+
//// }
10+
//// isNetworked(): this is (Networked & this) {
11+
//// return !!(this as Networked).host;
12+
//// }
13+
//// constructor(public path: string) {}
14+
//// }
15+
////
16+
//// class Item extends FileSystemObject {
17+
//// constructor(path: string, public content: string) { super(path); }
18+
//// }
19+
//// class Directory extends FileSystemObject {
20+
//// children: FileSystemObject[];
21+
//// }
22+
//// interface Networked {
23+
//// host: string;
24+
//// }
25+
////
26+
//// const obj: FileSystemObject = new Item("/foo", "");
27+
//// if (obj.isFile()) {
28+
//// obj./*1*/;
29+
//// if (obj.isNetworked()) {
30+
//// obj./*2*/;
31+
//// }
32+
//// }
33+
//// if (obj.isDirectory()) {
34+
//// obj./*3*/;
35+
//// if (obj.isNetworked()) {
36+
//// obj./*4*/;
37+
//// }
38+
//// }
39+
//// if (obj.isNetworked()) {
40+
//// obj./*5*/;
41+
//// }
42+
43+
goTo.marker("1");
44+
verify.completionListContains("content");
45+
goTo.marker("2");
46+
verify.completionListContains("host");
47+
goTo.marker("3");
48+
verify.completionListContains("children");
49+
goTo.marker("4");
50+
verify.completionListContains("host");
51+
goTo.marker("5");
52+
verify.completionListContains("host");
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//// interface Sundries {
4+
//// broken: boolean;
5+
//// }
6+
////
7+
//// interface Supplies {
8+
//// spoiled: boolean;
9+
//// }
10+
////
11+
//// interface Crate<T> {
12+
//// contents: T;
13+
//// isSundries(): this is Crate<Sundries>;
14+
//// isSupplies(): this is Crate<Supplies>;
15+
//// isPackedTight(): this is (this & {extraContents: T});
16+
//// }
17+
//// const crate: Crate<any>;
18+
//// if (crate.isPackedTight()) {
19+
//// crate./*1*/;
20+
//// }
21+
//// if (crate.isSundries()) {
22+
//// crate.contents./*2*/;
23+
//// if (crate.isPackedTight()) {
24+
//// crate./*3*/;
25+
//// }
26+
//// }
27+
//// if (crate.isSupplies()) {
28+
//// crate.contents./*4*/;
29+
//// if (crate.isPackedTight()) {
30+
//// crate./*5*/;
31+
//// }
32+
//// }
33+
34+
goTo.marker("1");
35+
verify.completionListContains("extraContents");
36+
goTo.marker("2");
37+
verify.completionListContains("broken");
38+
goTo.marker("3");
39+
verify.completionListContains("extraContents");
40+
goTo.marker("4");
41+
verify.completionListContains("spoiled");
42+
goTo.marker("5");
43+
verify.completionListContains("extraContents");
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//// class FileSystemObject {
4+
//// /*1*/isFile(): this is Item {
5+
//// return this instanceof Item;
6+
//// }
7+
//// /*2*/isDirectory(): this is Directory {
8+
//// return this instanceof Directory;
9+
//// }
10+
//// /*3*/isNetworked(): this is (Networked & this) {
11+
//// return !!(this as Networked).host;
12+
//// }
13+
//// constructor(public path: string) {}
14+
//// }
15+
////
16+
//// class Item extends FileSystemObject {
17+
//// constructor(path: string, public content: string) { super(path); }
18+
//// }
19+
//// class Directory extends FileSystemObject {
20+
//// children: FileSystemObject[];
21+
//// }
22+
//// interface Networked {
23+
//// host: string;
24+
//// }
25+
////
26+
//// const obj: FileSystemObject = new Item("/foo", "");
27+
//// if (obj.isFile/*4*/()) {
28+
//// obj.;
29+
//// if (obj.isNetworked/*5*/()) {
30+
//// obj.;
31+
//// }
32+
//// }
33+
//// if (obj.isDirectory/*6*/()) {
34+
//// obj.;
35+
//// if (obj.isNetworked/*7*/()) {
36+
//// obj.;
37+
//// }
38+
//// }
39+
//// if (obj.isNetworked/*8*/()) {
40+
//// obj.;
41+
//// }
42+
43+
goTo.marker("1");
44+
verify.quickInfoIs("(method) FileSystemObject.isFile(): this is Item");
45+
goTo.marker("2");
46+
verify.quickInfoIs("(method) FileSystemObject.isDirectory(): this is Directory");
47+
goTo.marker("3");
48+
verify.quickInfoIs("(method) FileSystemObject.isNetworked(): this is Networked & this");
49+
50+
goTo.marker("4");
51+
verify.quickInfoIs("(method) FileSystemObject.isFile(): this is Item");
52+
goTo.marker("5");
53+
verify.quickInfoIs("(method) FileSystemObject.isNetworked(): this is Networked & Item");
54+
goTo.marker("6");
55+
verify.quickInfoIs("(method) FileSystemObject.isDirectory(): this is Directory");
56+
goTo.marker("7");
57+
verify.quickInfoIs("(method) FileSystemObject.isNetworked(): this is Networked & Directory");
58+
goTo.marker("8");
59+
verify.quickInfoIs("(method) FileSystemObject.isNetworked(): this is Networked & FileSystemObject");
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//// interface Sundries {
4+
//// broken: boolean;
5+
//// }
6+
////
7+
//// interface Supplies {
8+
//// spoiled: boolean;
9+
//// }
10+
////
11+
//// interface Crate<T> {
12+
//// contents: T;
13+
//// /*1*/isSundries(): this is Crate<Sundries>;
14+
//// /*2*/isSupplies(): this is Crate<Supplies>;
15+
//// /*3*/isPackedTight(): this is (this & {extraContents: T});
16+
//// }
17+
//// const crate: Crate<any>;
18+
//// if (crate.isPackedTight/*4*/()) {
19+
//// crate.;
20+
//// }
21+
//// if (crate.isSundries/*5*/()) {
22+
//// crate.contents.;
23+
//// if (crate.isPackedTight/*6*/()) {
24+
//// crate.;
25+
//// }
26+
//// }
27+
//// if (crate.isSupplies/*7*/()) {
28+
//// crate.contents.;
29+
//// if (crate.isPackedTight/*8*/()) {
30+
//// crate.;
31+
//// }
32+
//// }
33+
34+
goTo.marker("1");
35+
verify.quickInfoIs("(method) Crate<T>.isSundries(): this is Crate<Sundries>");
36+
goTo.marker("2");
37+
verify.quickInfoIs("(method) Crate<T>.isSupplies(): this is Crate<Supplies>");
38+
goTo.marker("3");
39+
verify.quickInfoIs(`(method) Crate<T>.isPackedTight(): this is this & {
40+
extraContents: T;
41+
}`);
42+
goTo.marker("4");
43+
verify.quickInfoIs(`(method) Crate<any>.isPackedTight(): this is Crate<any> & {
44+
extraContents: any;
45+
}`);
46+
goTo.marker("5");
47+
verify.quickInfoIs("(method) Crate<any>.isSundries(): this is Crate<Sundries>");
48+
goTo.marker("6");
49+
verify.quickInfoIs(`(method) Crate<Sundries>.isPackedTight(): this is Crate<Sundries> & {
50+
extraContents: Sundries;
51+
}`);
52+
goTo.marker("7");
53+
verify.quickInfoIs("(method) Crate<any>.isSupplies(): this is Crate<Supplies>");
54+
goTo.marker("8");
55+
verify.quickInfoIs(`(method) Crate<Supplies>.isPackedTight(): this is Crate<Supplies> & {
56+
extraContents: Supplies;
57+
}`);

tests/cases/fourslash/thisPredicateMemberCompletions.ts

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)