Skip to content

Commit 52a94ca

Browse files
committed
Add tests for find-all-ref and rename operations
1 parent 7db2335 commit 52a94ca

4 files changed

+156
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
// === /tests/cases/fourslash/foo.js ===
2+
// /**
3+
// * @overload
4+
// * @param {number} x
5+
// * @returns {number}
6+
// *
7+
// * @overload
8+
// * @param {string} x
9+
// * @returns {string}
10+
// *
11+
// * @param {unknown} [|x|]
12+
// * @returns {unknown}
13+
// */
14+
// function foo([|x|]/*FIND ALL REFS*/) {
15+
// return [|x|];
16+
// }
17+
18+
[
19+
{
20+
"definition": {
21+
"containerKind": "",
22+
"containerName": "",
23+
"fileName": "/tests/cases/fourslash/foo.js",
24+
"kind": "parameter",
25+
"name": "(parameter) x: unknown",
26+
"textSpan": {
27+
"start": 183,
28+
"length": 1
29+
},
30+
"displayParts": [
31+
{
32+
"text": "(",
33+
"kind": "punctuation"
34+
},
35+
{
36+
"text": "parameter",
37+
"kind": "text"
38+
},
39+
{
40+
"text": ")",
41+
"kind": "punctuation"
42+
},
43+
{
44+
"text": " ",
45+
"kind": "space"
46+
},
47+
{
48+
"text": "x",
49+
"kind": "parameterName"
50+
},
51+
{
52+
"text": ":",
53+
"kind": "punctuation"
54+
},
55+
{
56+
"text": " ",
57+
"kind": "space"
58+
},
59+
{
60+
"text": "unknown",
61+
"kind": "keyword"
62+
}
63+
]
64+
},
65+
"references": [
66+
{
67+
"textSpan": {
68+
"start": 141,
69+
"length": 1
70+
},
71+
"fileName": "/tests/cases/fourslash/foo.js",
72+
"isWriteAccess": false,
73+
"isDefinition": false
74+
},
75+
{
76+
"textSpan": {
77+
"start": 183,
78+
"length": 1
79+
},
80+
"fileName": "/tests/cases/fourslash/foo.js",
81+
"isWriteAccess": true,
82+
"isDefinition": true
83+
},
84+
{
85+
"textSpan": {
86+
"start": 197,
87+
"length": 1
88+
},
89+
"fileName": "/tests/cases/fourslash/foo.js",
90+
"isWriteAccess": false,
91+
"isDefinition": false
92+
}
93+
]
94+
}
95+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*====== /tests/cases/fourslash/foo.js ======*/
2+
3+
/**
4+
* @overload
5+
* @param {number} x
6+
* @returns {number}
7+
*
8+
* @overload
9+
* @param {string} x
10+
* @returns {string}
11+
*
12+
* @param {unknown} RENAME
13+
* @returns {unknown}
14+
*/
15+
function foo([|RENAME|]) {
16+
return RENAME;
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @allowJs: true
4+
// @checkJs: true
5+
// @Filename: foo.js
6+
/////**
7+
//// * @overload
8+
//// * @param {number} x
9+
//// * @returns {number}
10+
//// *
11+
//// * @overload
12+
//// * @param {string} x
13+
//// * @returns {string}
14+
//// *
15+
//// * @param {unknown} x
16+
//// * @returns {unknown}
17+
//// */
18+
////function foo(x/*1*/) {
19+
//// return x;
20+
////}
21+
22+
verify.baselineFindAllReferences("1");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// @allowJs: true
4+
// @checkJs: true
5+
// @Filename: foo.js
6+
/////**
7+
//// * @overload
8+
//// * @param {number} x
9+
//// * @returns {number}
10+
//// *
11+
//// * @overload
12+
//// * @param {string} x
13+
//// * @returns {string}
14+
//// *
15+
//// * @param {unknown} x
16+
//// * @returns {unknown}
17+
//// */
18+
////function foo(x/**/) {
19+
//// return x;
20+
////}
21+
22+
verify.baselineRename("", {});

0 commit comments

Comments
 (0)