Skip to content

Commit 7b7e62c

Browse files
Modified/added tests.
1 parent a458d4b commit 7b7e62c

File tree

2 files changed

+116
-10
lines changed

2 files changed

+116
-10
lines changed

tests/cases/fourslash/docCommentTemplateVariableStatements01.ts

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,43 @@ function confirmNormalizedJsDoc(markerName: string, newTextOffset: number, templ
2828
////const c = 30;
2929
////
3030
/////*d*/
31-
////let d = function d(x, y, z) {
32-
//// return +(x + y + z);
31+
////let d = {
32+
//// foo: 10,
33+
//// bar: "20"
3334
////};
3435
////
3536
/////*e*/
36-
////let e = class E {
37+
////let e = function e(x, y, z) {
38+
//// return +(x + y + z);
39+
////};
40+
////
41+
/////*f*/
42+
////let f = class F {
3743
//// constructor(a, b, c) {
3844
//// this.a = a;
3945
//// this.b = b || (this.c = c);
4046
//// }
4147
////}
42-
////
43-
/////*f*/
44-
////let f = {
45-
//// foo: 10,
46-
//// bar: "20"
47-
////};
4848

49-
for (const varName of "abcdef".split("")) {
49+
for (const varName of "abcd".split("")) {
5050
confirmNormalizedJsDoc(varName, /*newTextOffset*/ 8, `
5151
/**
5252
*
5353
*/`);
5454
}
55+
56+
confirmNormalizedJsDoc("e", /*newTextOffset*/ 8, `
57+
/**
58+
*
59+
* @param x
60+
* @param y
61+
* @param z
62+
*/`);
63+
64+
confirmNormalizedJsDoc("f", /*newTextOffset*/ 8, `
65+
/**
66+
*
67+
* @param a
68+
* @param b
69+
* @param c
70+
*/`);
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
const CRLF = "\r\n";
4+
/**
5+
* @returns the given value with '\n' normalized to '\r\n' and with no leading newline
6+
*/
7+
function useCRLFAndStripLeadingNewline(str: string): string {
8+
str = str.replace(/\r?\n/g, CRLF);
9+
if (str.indexOf(CRLF) === 0) {
10+
str = str.slice(CRLF.length);
11+
}
12+
return str;
13+
}
14+
15+
function confirmNormalizedJsDoc(markerName: string, newTextOffset: number, template: string): void {
16+
goTo.marker(markerName);
17+
const normalized = useCRLFAndStripLeadingNewline(template);
18+
verify.DocCommentTemplate(normalized, newTextOffset);
19+
}
20+
21+
/////*a*/
22+
////var a = x => x
23+
////
24+
/////*b*/
25+
////let b = (x,y,z) => x + y + z;
26+
////
27+
/////*c*/
28+
////const c = ((x => +x))
29+
////
30+
/////*d*/
31+
////let d = (function () { })
32+
////
33+
/////*e*/
34+
////let e = function e([a,b,c]) {
35+
//// return "hello"
36+
////};
37+
////
38+
/////*f*/
39+
////let f = class {
40+
////}
41+
////
42+
/////*g*/
43+
////const g = ((class G {
44+
//// constructor(private x);
45+
//// constructor(x,y,z);
46+
//// constructor(x,y,z, ...okayThatsEnough) {
47+
//// }
48+
////}))
49+
50+
confirmNormalizedJsDoc("a", /*newTextOffset*/ 8, `
51+
/**
52+
*
53+
* @param x
54+
*/`);
55+
56+
confirmNormalizedJsDoc("b", /*newTextOffset*/ 8, `
57+
/**
58+
*
59+
* @param x
60+
* @param y
61+
* @param z
62+
*/`);
63+
64+
confirmNormalizedJsDoc("c", /*newTextOffset*/ 8, `
65+
/**
66+
*
67+
* @param x
68+
*/`);
69+
70+
confirmNormalizedJsDoc("d", /*newTextOffset*/ 8, `
71+
/**
72+
*
73+
*/`);
74+
75+
confirmNormalizedJsDoc("e", /*newTextOffset*/ 8, `
76+
/**
77+
*
78+
* @param param0
79+
*/`);
80+
81+
confirmNormalizedJsDoc("f", /*newTextOffset*/ 8, `
82+
/**
83+
*
84+
*/`);
85+
86+
confirmNormalizedJsDoc("g", /*newTextOffset*/ 8, `
87+
/**
88+
*
89+
* @param x
90+
*/`);

0 commit comments

Comments
 (0)