Skip to content

Commit 227198f

Browse files
author
Yui T
committed
Add tests and update baselines
1 parent fe838ba commit 227198f

12 files changed

+106
-30
lines changed

tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"0": {
77
"kind": "JSDocParameterTag",
88
"pos": 8,
9-
"end": 27,
9+
"end": 28,
1010
"atToken": {
1111
"kind": "AtToken",
1212
"pos": 8,
@@ -44,6 +44,6 @@
4444
},
4545
"length": 1,
4646
"pos": 8,
47-
"end": 27
47+
"end": 28
4848
}
4949
}

tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"0": {
77
"kind": "JSDocParameterTag",
88
"pos": 8,
9-
"end": 32,
9+
"end": 33,
1010
"atToken": {
1111
"kind": "AtToken",
1212
"pos": 8,
@@ -44,6 +44,6 @@
4444
},
4545
"length": 1,
4646
"pos": 8,
47-
"end": 32
47+
"end": 33
4848
}
4949
}

tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"0": {
77
"kind": "JSDocParameterTag",
88
"pos": 8,
9-
"end": 29,
9+
"end": 30,
1010
"atToken": {
1111
"kind": "AtToken",
1212
"pos": 8,
@@ -44,6 +44,6 @@
4444
},
4545
"length": 1,
4646
"pos": 8,
47-
"end": 29
47+
"end": 30
4848
}
4949
}

tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"0": {
77
"kind": "JSDocParameterTag",
88
"pos": 8,
9-
"end": 29,
9+
"end": 30,
1010
"atToken": {
1111
"kind": "AtToken",
1212
"pos": 8,
@@ -44,6 +44,6 @@
4444
},
4545
"length": 1,
4646
"pos": 8,
47-
"end": 29
47+
"end": 30
4848
}
4949
}

tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"0": {
77
"kind": "JSDocParameterTag",
88
"pos": 8,
9-
"end": 18,
9+
"end": 19,
1010
"atToken": {
1111
"kind": "AtToken",
1212
"pos": 8,
@@ -34,6 +34,6 @@
3434
},
3535
"length": 1,
3636
"pos": 8,
37-
"end": 18
37+
"end": 19
3838
}
3939
}

tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"0": {
77
"kind": "JSDocParameterTag",
88
"pos": 8,
9-
"end": 29,
9+
"end": 32,
1010
"atToken": {
1111
"kind": "AtToken",
1212
"pos": 8,
@@ -45,7 +45,7 @@
4545
"1": {
4646
"kind": "JSDocParameterTag",
4747
"pos": 34,
48-
"end": 55,
48+
"end": 56,
4949
"atToken": {
5050
"kind": "AtToken",
5151
"pos": 34,
@@ -83,6 +83,6 @@
8383
},
8484
"length": 2,
8585
"pos": 8,
86-
"end": 55
86+
"end": 56
8787
}
8888
}

tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"0": {
77
"kind": "JSDocParameterTag",
88
"pos": 8,
9-
"end": 29,
9+
"end": 30,
1010
"atToken": {
1111
"kind": "AtToken",
1212
"pos": 8,
@@ -45,7 +45,7 @@
4545
"1": {
4646
"kind": "JSDocParameterTag",
4747
"pos": 30,
48-
"end": 51,
48+
"end": 52,
4949
"atToken": {
5050
"kind": "AtToken",
5151
"pos": 30,
@@ -83,6 +83,6 @@
8383
},
8484
"length": 2,
8585
"pos": 8,
86-
"end": 51
86+
"end": 52
8787
}
8888
}

tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,6 @@
8282
"end": 56,
8383
"text": "property"
8484
},
85-
"name": {
86-
"kind": "Identifier",
87-
"pos": 66,
88-
"end": 69,
89-
"text": "age"
90-
},
9185
"typeExpression": {
9286
"kind": "JSDocTypeExpression",
9387
"pos": 57,
@@ -97,6 +91,18 @@
9791
"pos": 58,
9892
"end": 64
9993
}
94+
},
95+
"postParameterName": {
96+
"kind": "Identifier",
97+
"pos": 66,
98+
"end": 69,
99+
"text": "age"
100+
},
101+
"name": {
102+
"kind": "Identifier",
103+
"pos": 66,
104+
"end": 69,
105+
"text": "age"
100106
}
101107
},
102108
{
@@ -114,12 +120,6 @@
114120
"end": 83,
115121
"text": "property"
116122
},
117-
"name": {
118-
"kind": "Identifier",
119-
"pos": 93,
120-
"end": 97,
121-
"text": "name"
122-
},
123123
"typeExpression": {
124124
"kind": "JSDocTypeExpression",
125125
"pos": 84,
@@ -129,6 +129,18 @@
129129
"pos": 85,
130130
"end": 91
131131
}
132+
},
133+
"postParameterName": {
134+
"kind": "Identifier",
135+
"pos": 93,
136+
"end": 97,
137+
"text": "name"
138+
},
139+
"name": {
140+
"kind": "Identifier",
141+
"pos": 93,
142+
"end": 97,
143+
"text": "name"
132144
}
133145
}
134146
]

tests/baselines/reference/checkJsdocTypedefInParamTag1.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,18 @@
1111
*/
1212
function foo(opts) {}
1313

14-
foo({x: 'abc'});
14+
foo({x: 'abc'});
15+
16+
/**
17+
* @typedef {Object} AnotherOpts
18+
* @property anotherX {string}
19+
* @property anotherY {string=}
20+
*
21+
* @param {AnotherOpts} opts
22+
*/
23+
function foo1(opts) {}
24+
25+
foo1({anotherX: "world"});
1526

1627
//// [0.js]
1728
// @ts-check
@@ -26,3 +37,12 @@ foo({x: 'abc'});
2637
*/
2738
function foo(opts) { }
2839
foo({ x: 'abc' });
40+
/**
41+
* @typedef {Object} AnotherOpts
42+
* @property anotherX {string}
43+
* @property anotherY {string=}
44+
*
45+
* @param {AnotherOpts} opts
46+
*/
47+
function foo1(opts) { }
48+
foo1({ anotherX: "world" });

tests/baselines/reference/checkJsdocTypedefInParamTag1.symbols

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,18 @@ foo({x: 'abc'});
1717
>foo : Symbol(foo, Decl(0.js, 0, 0))
1818
>x : Symbol(x, Decl(0.js, 12, 5))
1919

20+
/**
21+
* @typedef {Object} AnotherOpts
22+
* @property anotherX {string}
23+
* @property anotherY {string=}
24+
*
25+
* @param {AnotherOpts} opts
26+
*/
27+
function foo1(opts) {}
28+
>foo1 : Symbol(foo1, Decl(0.js, 12, 16))
29+
>opts : Symbol(opts, Decl(0.js, 21, 14))
30+
31+
foo1({anotherX: "world"});
32+
>foo1 : Symbol(foo1, Decl(0.js, 12, 16))
33+
>anotherX : Symbol(anotherX, Decl(0.js, 23, 6))
34+

tests/baselines/reference/checkJsdocTypedefInParamTag1.types

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,21 @@ foo({x: 'abc'});
2020
>x : string
2121
>'abc' : "abc"
2222

23+
/**
24+
* @typedef {Object} AnotherOpts
25+
* @property anotherX {string}
26+
* @property anotherY {string=}
27+
*
28+
* @param {AnotherOpts} opts
29+
*/
30+
function foo1(opts) {}
31+
>foo1 : (opts: { anotherX: string; anotherY?: string; }) => void
32+
>opts : { anotherX: string; anotherY?: string; }
33+
34+
foo1({anotherX: "world"});
35+
>foo1({anotherX: "world"}) : void
36+
>foo1 : (opts: { anotherX: string; anotherY?: string; }) => void
37+
>{anotherX: "world"} : { anotherX: string; }
38+
>anotherX : string
39+
>"world" : "world"
40+

tests/cases/conformance/jsdoc/checkJsdocTypedefInParamTag1.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,15 @@
1414
*/
1515
function foo(opts) {}
1616

17-
foo({x: 'abc'});
17+
foo({x: 'abc'});
18+
19+
/**
20+
* @typedef {Object} AnotherOpts
21+
* @property anotherX {string}
22+
* @property anotherY {string=}
23+
*
24+
* @param {AnotherOpts} opts
25+
*/
26+
function foo1(opts) {}
27+
28+
foo1({anotherX: "world"});

0 commit comments

Comments
 (0)