mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-22 22:55:36 -05:00
Fixed up fourslash tests to only test functions.
This commit is contained in:
52
tests/cases/fourslash/thisPredicateFunctionCompletions01.ts
Normal file
52
tests/cases/fourslash/thisPredicateFunctionCompletions01.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//// class FileSystemObject {
|
||||
//// isFile(): this is Item {
|
||||
//// return this instanceof Item;
|
||||
//// }
|
||||
//// isDirectory(): this is Directory {
|
||||
//// return this instanceof Directory;
|
||||
//// }
|
||||
//// isNetworked(): this is (Networked & this) {
|
||||
//// return !!(this as Networked).host;
|
||||
//// }
|
||||
//// 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;
|
||||
//// }
|
||||
////
|
||||
//// const obj: FileSystemObject = new Item("/foo", "");
|
||||
//// if (obj.isFile()) {
|
||||
//// obj./*1*/;
|
||||
//// if (obj.isNetworked()) {
|
||||
//// obj./*2*/;
|
||||
//// }
|
||||
//// }
|
||||
//// if (obj.isDirectory()) {
|
||||
//// obj./*3*/;
|
||||
//// if (obj.isNetworked()) {
|
||||
//// obj./*4*/;
|
||||
//// }
|
||||
//// }
|
||||
//// if (obj.isNetworked()) {
|
||||
//// obj./*5*/;
|
||||
//// }
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("content");
|
||||
goTo.marker("2");
|
||||
verify.completionListContains("host");
|
||||
goTo.marker("3");
|
||||
verify.completionListContains("children");
|
||||
goTo.marker("4");
|
||||
verify.completionListContains("host");
|
||||
goTo.marker("5");
|
||||
verify.completionListContains("host");
|
||||
43
tests/cases/fourslash/thisPredicateFunctionCompletions02.ts
Normal file
43
tests/cases/fourslash/thisPredicateFunctionCompletions02.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//// interface Sundries {
|
||||
//// broken: boolean;
|
||||
//// }
|
||||
////
|
||||
//// interface Supplies {
|
||||
//// spoiled: boolean;
|
||||
//// }
|
||||
////
|
||||
//// interface Crate<T> {
|
||||
//// contents: T;
|
||||
//// isSundries(): this is Crate<Sundries>;
|
||||
//// isSupplies(): this is Crate<Supplies>;
|
||||
//// isPackedTight(): this is (this & {extraContents: T});
|
||||
//// }
|
||||
//// const crate: Crate<any>;
|
||||
//// if (crate.isPackedTight()) {
|
||||
//// crate./*1*/;
|
||||
//// }
|
||||
//// if (crate.isSundries()) {
|
||||
//// crate.contents./*2*/;
|
||||
//// if (crate.isPackedTight()) {
|
||||
//// crate./*3*/;
|
||||
//// }
|
||||
//// }
|
||||
//// if (crate.isSupplies()) {
|
||||
//// crate.contents./*4*/;
|
||||
//// if (crate.isPackedTight()) {
|
||||
//// crate./*5*/;
|
||||
//// }
|
||||
//// }
|
||||
|
||||
goTo.marker("1");
|
||||
verify.completionListContains("extraContents");
|
||||
goTo.marker("2");
|
||||
verify.completionListContains("broken");
|
||||
goTo.marker("3");
|
||||
verify.completionListContains("extraContents");
|
||||
goTo.marker("4");
|
||||
verify.completionListContains("spoiled");
|
||||
goTo.marker("5");
|
||||
verify.completionListContains("extraContents");
|
||||
59
tests/cases/fourslash/thisPredicateFunctionQuickInfo01.ts
Normal file
59
tests/cases/fourslash/thisPredicateFunctionQuickInfo01.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//// class FileSystemObject {
|
||||
//// /*1*/isFile(): this is Item {
|
||||
//// return this instanceof Item;
|
||||
//// }
|
||||
//// /*2*/isDirectory(): this is Directory {
|
||||
//// return this instanceof Directory;
|
||||
//// }
|
||||
//// /*3*/isNetworked(): this is (Networked & this) {
|
||||
//// return !!(this as Networked).host;
|
||||
//// }
|
||||
//// 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;
|
||||
//// }
|
||||
////
|
||||
//// const obj: FileSystemObject = new Item("/foo", "");
|
||||
//// if (obj.isFile/*4*/()) {
|
||||
//// obj.;
|
||||
//// if (obj.isNetworked/*5*/()) {
|
||||
//// obj.;
|
||||
//// }
|
||||
//// }
|
||||
//// if (obj.isDirectory/*6*/()) {
|
||||
//// obj.;
|
||||
//// if (obj.isNetworked/*7*/()) {
|
||||
//// obj.;
|
||||
//// }
|
||||
//// }
|
||||
//// if (obj.isNetworked/*8*/()) {
|
||||
//// obj.;
|
||||
//// }
|
||||
|
||||
goTo.marker("1");
|
||||
verify.quickInfoIs("(method) FileSystemObject.isFile(): this is Item");
|
||||
goTo.marker("2");
|
||||
verify.quickInfoIs("(method) FileSystemObject.isDirectory(): this is Directory");
|
||||
goTo.marker("3");
|
||||
verify.quickInfoIs("(method) FileSystemObject.isNetworked(): this is Networked & this");
|
||||
|
||||
goTo.marker("4");
|
||||
verify.quickInfoIs("(method) FileSystemObject.isFile(): this is Item");
|
||||
goTo.marker("5");
|
||||
verify.quickInfoIs("(method) FileSystemObject.isNetworked(): this is Networked & Item");
|
||||
goTo.marker("6");
|
||||
verify.quickInfoIs("(method) FileSystemObject.isDirectory(): this is Directory");
|
||||
goTo.marker("7");
|
||||
verify.quickInfoIs("(method) FileSystemObject.isNetworked(): this is Networked & Directory");
|
||||
goTo.marker("8");
|
||||
verify.quickInfoIs("(method) FileSystemObject.isNetworked(): this is Networked & FileSystemObject");
|
||||
57
tests/cases/fourslash/thisPredicateFunctionQuickInfo02.ts
Normal file
57
tests/cases/fourslash/thisPredicateFunctionQuickInfo02.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//// interface Sundries {
|
||||
//// broken: boolean;
|
||||
//// }
|
||||
////
|
||||
//// interface Supplies {
|
||||
//// spoiled: boolean;
|
||||
//// }
|
||||
////
|
||||
//// interface Crate<T> {
|
||||
//// contents: T;
|
||||
//// /*1*/isSundries(): this is Crate<Sundries>;
|
||||
//// /*2*/isSupplies(): this is Crate<Supplies>;
|
||||
//// /*3*/isPackedTight(): this is (this & {extraContents: T});
|
||||
//// }
|
||||
//// const crate: Crate<any>;
|
||||
//// if (crate.isPackedTight/*4*/()) {
|
||||
//// crate.;
|
||||
//// }
|
||||
//// if (crate.isSundries/*5*/()) {
|
||||
//// crate.contents.;
|
||||
//// if (crate.isPackedTight/*6*/()) {
|
||||
//// crate.;
|
||||
//// }
|
||||
//// }
|
||||
//// if (crate.isSupplies/*7*/()) {
|
||||
//// crate.contents.;
|
||||
//// if (crate.isPackedTight/*8*/()) {
|
||||
//// crate.;
|
||||
//// }
|
||||
//// }
|
||||
|
||||
goTo.marker("1");
|
||||
verify.quickInfoIs("(method) Crate<T>.isSundries(): this is Crate<Sundries>");
|
||||
goTo.marker("2");
|
||||
verify.quickInfoIs("(method) Crate<T>.isSupplies(): this is Crate<Supplies>");
|
||||
goTo.marker("3");
|
||||
verify.quickInfoIs(`(method) Crate<T>.isPackedTight(): this is this & {
|
||||
extraContents: T;
|
||||
}`);
|
||||
goTo.marker("4");
|
||||
verify.quickInfoIs(`(method) Crate<any>.isPackedTight(): this is Crate<any> & {
|
||||
extraContents: any;
|
||||
}`);
|
||||
goTo.marker("5");
|
||||
verify.quickInfoIs("(method) Crate<any>.isSundries(): this is Crate<Sundries>");
|
||||
goTo.marker("6");
|
||||
verify.quickInfoIs(`(method) Crate<Sundries>.isPackedTight(): this is Crate<Sundries> & {
|
||||
extraContents: Sundries;
|
||||
}`);
|
||||
goTo.marker("7");
|
||||
verify.quickInfoIs("(method) Crate<any>.isSupplies(): this is Crate<Supplies>");
|
||||
goTo.marker("8");
|
||||
verify.quickInfoIs(`(method) Crate<Supplies>.isPackedTight(): this is Crate<Supplies> & {
|
||||
extraContents: Supplies;
|
||||
}`);
|
||||
@@ -1,95 +0,0 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//// 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<T> {
|
||||
//// contents: T;
|
||||
//// is/*5*/Sundries: this is Crate<Sundries>;
|
||||
//// is/*6*/Supplies: this is Crate<Supplies>;
|
||||
//// 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<any>;
|
||||
//// 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");
|
||||
@@ -1,117 +0,0 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//// 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<T> {
|
||||
//// contents: T;
|
||||
//// is/*5*/Sundries: this is Crate<Sundries>;
|
||||
//// is/*6*/Supplies: this is Crate<Supplies>;
|
||||
//// 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<any>;
|
||||
//// 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("1");
|
||||
verify.quickInfoIs("(property) FileSystemObject.isFile: this is Item");
|
||||
goTo.marker("2");
|
||||
verify.quickInfoIs("(property) FileSystemObject.isFile: this is Item");
|
||||
goTo.marker("3");
|
||||
verify.quickInfoIs("(property) FileSystemObject.isDirectory: this is Directory");
|
||||
goTo.marker("4");
|
||||
verify.quickInfoIs("(property) FileSystemObject.isNetworked: this is Networked & this");
|
||||
goTo.marker("5");
|
||||
verify.quickInfoIs("(property) Crate<T>.isSundries: this is Crate<Sundries>");
|
||||
goTo.marker("6");
|
||||
verify.quickInfoIs("(property) Crate<T>.isSupplies: this is Crate<Supplies>");
|
||||
goTo.marker("7");
|
||||
verify.quickInfoIs(`(property) Crate<T>.isPackedTight: this is this & {
|
||||
extraContents: T;
|
||||
}`);
|
||||
goTo.marker("8");
|
||||
verify.quickInfoIs("(property) FileSystemObject.isFile: this is Item");
|
||||
goTo.marker("10");
|
||||
verify.quickInfoIs("(property) FileSystemObject.isNetworked: this is Networked & Item");
|
||||
goTo.marker("12");
|
||||
verify.quickInfoIs("(property) FileSystemObject.isDirectory: this is Directory");
|
||||
goTo.marker("14");
|
||||
verify.quickInfoIs("(property) FileSystemObject.isNetworked: this is Networked & Directory");
|
||||
goTo.marker("16");
|
||||
verify.quickInfoIs("(property) FileSystemObject.isNetworked: this is Networked & FileSystemObject");
|
||||
goTo.marker("18");
|
||||
verify.quickInfoIs(`(property) Crate<any>.isPackedTight: this is Crate<any> & {
|
||||
extraContents: any;
|
||||
}`);
|
||||
goTo.marker("20");
|
||||
verify.quickInfoIs("(property) Crate<any>.isSundries: this is Crate<Sundries>");
|
||||
goTo.marker("22");
|
||||
verify.quickInfoIs(`(property) Crate<Sundries>.isPackedTight: this is Crate<Sundries> & {
|
||||
extraContents: Sundries;
|
||||
}`);
|
||||
goTo.marker("24");
|
||||
verify.quickInfoIs("(property) Crate<any>.isSupplies: this is Crate<Supplies>");
|
||||
goTo.marker("26");
|
||||
verify.quickInfoIs(`(property) Crate<Supplies>.isPackedTight: this is Crate<Supplies> & {
|
||||
extraContents: Supplies;
|
||||
}`);
|
||||
Reference in New Issue
Block a user