Add fourslash tests for function(new/this:T) syntax

This commit is contained in:
Nathan Shively-Sanders 2017-07-13 14:49:50 -07:00
parent ac478a9720
commit d24b3a3cba
7 changed files with 60 additions and 0 deletions

View file

@ -0,0 +1,4 @@
/// <reference path='fourslash.ts' />
//// var x: [|?|] = 12;
verify.rangeAfterCodeFix("any");

View file

@ -0,0 +1,10 @@
///<reference path="fourslash.ts" />
// @allowJs: true
// @Filename: Foo.js
/////** @type {function (new: string, string): string} */
////var f = function (s) { return /**/; }
goTo.marker();
verify.completionListCount(115);
verify.completionListContains('new', 'new', '', 'keyword');

View file

@ -0,0 +1,9 @@
///<reference path="fourslash.ts" />
// @allowJs: true
// @Filename: Foo.js
/////** @type {function (this: string, string): string} */
////var f = function (s) { return /**/; }
goTo.marker();
verify.completionListCount(115);
verify.completionListContains('this');

View file

@ -0,0 +1,9 @@
///<reference path="fourslash.ts" />
// @allowJs: true
// @Filename: Foo.js
/////** @type {function ([|new|]: string, string): string} */
////var f;
const [a0] = test.ranges();
// should be: verify.referenceGroups([a0], [{ definition: "new", ranges: [a0] }]);
verify.referenceGroups([a0], undefined);

View file

@ -0,0 +1,11 @@
///<reference path="fourslash.ts" />
// @allowJs: true
// @Filename: Foo.js
/////** @type {function (this: string, string): string} */
////var f = function (s) { return [|this|] + s; }
const [a0] = test.ranges();
// should be: verify.referenceGroups([a0, a1], [{ definition: "this", ranges: [a0] }]);
// but is currently
verify.referenceGroups([], undefined);

View file

@ -0,0 +1,8 @@
///<reference path="fourslash.ts" />
// @allowJs: true
// @Filename: Foo.js
/////** @type {function (new: string, string): string} */
////var f/**/;
goTo.marker();
verify.quickInfoIs('var f: new (arg1: string) => string');

View file

@ -0,0 +1,9 @@
///<reference path="fourslash.ts" />
// @allowJs: true
// @Filename: Foo.js
/////** @type {function (this: string, string): string} */
////var f/**/ = function (s) { return s; }
goTo.marker();
verify.quickInfoIs('var f: (this: string, arg1: string) => string');