Skip to content

Commit d24b3a3

Browse files
committed
Add fourslash tests for function(new/this:T) syntax
1 parent ac478a9 commit d24b3a3

7 files changed

Lines changed: 60 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/// <reference path='fourslash.ts' />
2+
//// var x: [|?|] = 12;
3+
4+
verify.rangeAfterCodeFix("any");
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
///<reference path="fourslash.ts" />
3+
// @allowJs: true
4+
// @Filename: Foo.js
5+
/////** @type {function (new: string, string): string} */
6+
////var f = function (s) { return /**/; }
7+
8+
goTo.marker();
9+
verify.completionListCount(115);
10+
verify.completionListContains('new', 'new', '', 'keyword');
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
///<reference path="fourslash.ts" />
2+
// @allowJs: true
3+
// @Filename: Foo.js
4+
/////** @type {function (this: string, string): string} */
5+
////var f = function (s) { return /**/; }
6+
7+
goTo.marker();
8+
verify.completionListCount(115);
9+
verify.completionListContains('this');
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
///<reference path="fourslash.ts" />
2+
// @allowJs: true
3+
// @Filename: Foo.js
4+
/////** @type {function ([|new|]: string, string): string} */
5+
////var f;
6+
7+
const [a0] = test.ranges();
8+
// should be: verify.referenceGroups([a0], [{ definition: "new", ranges: [a0] }]);
9+
verify.referenceGroups([a0], undefined);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
///<reference path="fourslash.ts" />
2+
// @allowJs: true
3+
// @Filename: Foo.js
4+
/////** @type {function (this: string, string): string} */
5+
////var f = function (s) { return [|this|] + s; }
6+
7+
const [a0] = test.ranges();
8+
// should be: verify.referenceGroups([a0, a1], [{ definition: "this", ranges: [a0] }]);
9+
10+
// but is currently
11+
verify.referenceGroups([], undefined);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
///<reference path="fourslash.ts" />
2+
// @allowJs: true
3+
// @Filename: Foo.js
4+
/////** @type {function (new: string, string): string} */
5+
////var f/**/;
6+
7+
goTo.marker();
8+
verify.quickInfoIs('var f: new (arg1: string) => string');
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
///<reference path="fourslash.ts" />
3+
// @allowJs: true
4+
// @Filename: Foo.js
5+
/////** @type {function (this: string, string): string} */
6+
////var f/**/ = function (s) { return s; }
7+
8+
goTo.marker();
9+
verify.quickInfoIs('var f: (this: string, arg1: string) => string');

0 commit comments

Comments
 (0)