diff --git a/tests/cases/fourslash/findAllRefsThisKeywordMultipleFiles.ts b/tests/cases/fourslash/findAllRefsThisKeywordMultipleFiles.ts new file mode 100644 index 00000000000..bc31ffd1579 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsThisKeywordMultipleFiles.ts @@ -0,0 +1,15 @@ +/// + +// @Filename: file1.ts +////this; this; + +// @Filename: file2.ts +////this; +////this; + +// @Filename: file3.ts +//// ((x = this, y) => t/**/his)(this, this); + +goTo.file("file1.ts"); +goTo.marker(); +verify.referencesCountIs(8); \ No newline at end of file diff --git a/tests/cases/fourslash/getOccurrencesThis.ts b/tests/cases/fourslash/getOccurrencesThis.ts new file mode 100644 index 00000000000..e4b059b9cf9 --- /dev/null +++ b/tests/cases/fourslash/getOccurrencesThis.ts @@ -0,0 +1,154 @@ +/// + +////[|this|]; +////[|th/**/is|]; +//// +////function f() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +////} +//// +////module m { +//// function f() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////class A { +//// public b = this.method1; +//// +//// public method1() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// private method2() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// public static staticB = this.staticMethod1; +//// +//// public static staticMethod1() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// private static staticMethod2() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////var x = { +//// f() { +//// this; +//// }, +//// g() { +//// this; +//// } +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); +}); + +goTo.marker(); +test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/getOccurrencesThis2.ts b/tests/cases/fourslash/getOccurrencesThis2.ts new file mode 100644 index 00000000000..3df30369e3e --- /dev/null +++ b/tests/cases/fourslash/getOccurrencesThis2.ts @@ -0,0 +1,154 @@ +/// + +////this; +////this; +//// +////function f() { +//// [|this|]; +//// [|this|]; +//// () => [|this|]; +//// () => { +//// if ([|this|]) { +//// [|this|]; +//// } +//// else { +//// [|t/**/his|].this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +////} +//// +////module m { +//// function f() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////class A { +//// public b = this.method1; +//// +//// public method1() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// private method2() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// public static staticB = this.staticMethod1; +//// +//// public static staticMethod1() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// private static staticMethod2() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////var x = { +//// f() { +//// this; +//// }, +//// g() { +//// this; +//// } +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); +}); + +goTo.marker(); +test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/getOccurrencesThis3.ts b/tests/cases/fourslash/getOccurrencesThis3.ts new file mode 100644 index 00000000000..7ee18a31286 --- /dev/null +++ b/tests/cases/fourslash/getOccurrencesThis3.ts @@ -0,0 +1,154 @@ +/// + +////this; +////this; +//// +////function f() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// [|t/**/his|]; +//// (function (_) { +//// this; +//// })([|this|]); +//// } +////} +//// +////module m { +//// function f() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////class A { +//// public b = this.method1; +//// +//// public method1() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// private method2() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// public static staticB = this.staticMethod1; +//// +//// public static staticMethod1() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// private static staticMethod2() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////var x = { +//// f() { +//// this; +//// }, +//// g() { +//// this; +//// } +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); +}); + +goTo.marker(); +test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/getOccurrencesThis4.ts b/tests/cases/fourslash/getOccurrencesThis4.ts new file mode 100644 index 00000000000..75a9383f88e --- /dev/null +++ b/tests/cases/fourslash/getOccurrencesThis4.ts @@ -0,0 +1,154 @@ +/// + +////this; +////this; +//// +////function f() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +////} +//// +////module m { +//// function f() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////class A { +//// public b = [|this|].method1; +//// +//// public method1() { +//// [|this|]; +//// [|this|]; +//// () => [|this|]; +//// () => { +//// if ([|this|]) { +//// [|this|]; +//// } +//// else { +//// [|this|].this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// private method2() { +//// [|this|]; +//// [|this|]; +//// () => [|t/**/his|]; +//// () => { +//// if ([|this|]) { +//// [|this|]; +//// } +//// else { +//// [|this|].this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// public static staticB = this.staticMethod1; +//// +//// public static staticMethod1() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// private static staticMethod2() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////var x = { +//// f() { +//// this; +//// }, +//// g() { +//// this; +//// } +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); +}); + +goTo.marker(); +test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/getOccurrencesThis5.ts b/tests/cases/fourslash/getOccurrencesThis5.ts new file mode 100644 index 00000000000..86ce16b16be --- /dev/null +++ b/tests/cases/fourslash/getOccurrencesThis5.ts @@ -0,0 +1,154 @@ +/// + +////this; +////this; +//// +////function f() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +////} +//// +////module m { +//// function f() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////class A { +//// public b = this.method1; +//// +//// public method1() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// private method2() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// public static staticB = [|this|].staticMethod1; +//// +//// public static staticMethod1() { +//// [|this|]; +//// [|this|]; +//// () => [|this|]; +//// () => { +//// if ([|this|]) { +//// [|this|]; +//// } +//// else { +//// [|this|].this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// private static staticMethod2() { +//// [|this|]; +//// [|this|]; +//// () => [|this|]; +//// () => { +//// if ([|this|]) { +//// [|this|]; +//// } +//// else { +//// [|t/**/his|].this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////var x = { +//// f() { +//// this; +//// }, +//// g() { +//// this; +//// } +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); +}); + +goTo.marker(); +test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/getOccurrencesThisNegatives.ts b/tests/cases/fourslash/getOccurrencesThisNegatives.ts new file mode 100644 index 00000000000..95c676e0add --- /dev/null +++ b/tests/cases/fourslash/getOccurrencesThisNegatives.ts @@ -0,0 +1,149 @@ +/// + +////this/*1*/; +////this; +//// +////function f() { +//// this/*2*/; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +////} +//// +////module m { +//// var x = th/*6*/is; +//// function f() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////class A { +//// public b = this.method1; +//// +//// public method1() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this/*3*/; +//// })(this); +//// } +//// } +//// +//// private method2() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// public static staticB = this.staticMethod1; +//// +//// public static staticMethod1() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// private static staticMethod2() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////var x = { +//// f() { +//// this/*4*/; +//// }, +//// g() { +//// this/*5*/; +//// } +////} + + +test.markers().forEach(m => { + goTo.position(m.position, m.fileName) + + verify.occurrencesAtPositionCount(0); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/getOccurrencesThisNegatives2.ts b/tests/cases/fourslash/getOccurrencesThisNegatives2.ts new file mode 100644 index 00000000000..65fb37d09b4 --- /dev/null +++ b/tests/cases/fourslash/getOccurrencesThisNegatives2.ts @@ -0,0 +1,147 @@ +/// + +////this; +////this; +//// +////function f() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.t/*1*/his; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +////} +//// +////module m { +//// function f() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this./*2*/this; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////class A { +//// public b = this.method1; +//// +//// public method1() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.thi/*3*/s; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// private method2() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.t/*4*/his; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// public static staticB = this.staticMethod1; +//// +//// public static staticMethod1() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.th/*5*/is; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +//// +//// private static staticMethod2() { +//// this; +//// this; +//// () => this; +//// () => { +//// if (this) { +//// this; +//// } +//// else { +//// this.th/*6*/is; +//// } +//// } +//// function inside() { +//// this; +//// (function (_) { +//// this; +//// })(this); +//// } +//// } +////} +//// +////var x = { +//// f() { +//// this; +//// }, +//// g() { +//// this; +//// } +////} + + +test.markers().forEach(m => { + goTo.position(m.position, m.fileName) + verify.occurrencesAtPositionCount(1); +});