Add fourslash tests for function(new/this:T) syntax
This commit is contained in:
parent
ac478a9720
commit
d24b3a3cba
7 changed files with 60 additions and 0 deletions
4
tests/cases/fourslash/codeFixChangeJSDocSyntax1.ts
Normal file
4
tests/cases/fourslash/codeFixChangeJSDocSyntax1.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
//// var x: [|?|] = 12;
|
||||
|
||||
verify.rangeAfterCodeFix("any");
|
10
tests/cases/fourslash/completionInJSDocFunctionNew.ts
Normal file
10
tests/cases/fourslash/completionInJSDocFunctionNew.ts
Normal 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');
|
9
tests/cases/fourslash/completionInJSDocFunctionThis.ts
Normal file
9
tests/cases/fourslash/completionInJSDocFunctionThis.ts
Normal 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');
|
|
@ -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);
|
11
tests/cases/fourslash/findAllReferencesJSDocFunctionThis.ts
Normal file
11
tests/cases/fourslash/findAllReferencesJSDocFunctionThis.ts
Normal 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);
|
8
tests/cases/fourslash/quickInfoJSDocFunctionNew.ts
Normal file
8
tests/cases/fourslash/quickInfoJSDocFunctionNew.ts
Normal 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');
|
9
tests/cases/fourslash/quickInfoJSDocFunctionThis.ts
Normal file
9
tests/cases/fourslash/quickInfoJSDocFunctionThis.ts
Normal 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');
|
Loading…
Reference in a new issue