Skip to content

Commit fff2f7b

Browse files
author
Arthur Ozga
committed
Add Tests
1 parent 24b29f1 commit fff2f7b

6 files changed

Lines changed: 87 additions & 1 deletion

tests/cases/fourslash/docCommentScaffoldingEmptyFile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// @Filename: emptyFile.ts
44
/////*0*/
55

6-
verify.DocCommentScaffolding(0, { newText: "/** */", cursorOffset: 3});
6+
verify.DocCommentScaffolding("/** */", 3);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @Filename: emptyFile.ts
4+
/////*0*/
5+
//// /*1*/
6+
//// function foo(x: number, y: string): boolean {}
7+
8+
const noIndentEmptyScaffolding = "/**\n * \n * @param x \n * @param y\n */";
9+
const oneIndentEmptyScaffolding = "/**\n * \n * @param x \n * @param y\n */";
10+
const noIndentOffset = 7;
11+
const oneIndentOffset = noIndentOffset + 4;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @Filename: emptyFile.ts
4+
//// /* /*0*/ */
5+
goTo.marker("0");
6+
verify.DocCommentScaffolding("/**", 3);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @Filename: emptyFile.ts
4+
//// // We want to check off-by-one errors in assessing the end of the comment, so we check twice,
5+
//// // first with a trailing space and then without.
6+
//// // /*0*/
7+
//// // /*1*/
8+
/////*2*/
9+
//// // We also want to check EOF handling at the end of a comment
10+
//// // /*3*/
11+
12+
goTo.marker("0");
13+
verify.DocCommentScaffolding("/**", 3);
14+
15+
goTo.marker("1");
16+
verify.DocCommentScaffolding("/**", 3);
17+
18+
goTo.marker("2");
19+
verify.DocCommentScaffolding("/** */", 3);
20+
21+
goTo.marker("3");
22+
verify.DocCommentScaffolding("/**", 3);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @Filename: emptyFile.ts
4+
/////*0*/
5+
//// /*1*/
6+
//// /*2*/function /*3*/foo/*4*/(/*5*/) /*6*/{ /*7*/}/*8*/
7+
8+
const noIndentEmptyScaffolding = "/**\n * \n */";
9+
const oneIndentEmptyScaffolding = "/**\n * \n */";
10+
const twoIndentEmptyScaffolding = "/**\n * \n */";
11+
const noIndentOffset = 7;
12+
const oneIndentOffset = noIndentOffset + 4;
13+
const twoIndentOffset = oneIndentOffset + 4;
14+
15+
goTo.marker("0");
16+
verify.DocCommentScaffolding(noIndentEmptyScaffolding, noIndentOffset);
17+
18+
goTo.marker("1");
19+
verify.DocCommentScaffolding(oneIndentEmptyScaffolding, oneIndentOffset);
20+
21+
goTo.marker("2");
22+
verify.DocCommentScaffolding(twoIndentEmptyScaffolding, twoIndentOffset);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @Filename: emptyFile.ts
4+
////function /*0*/foo/*1*/(/*2*/) /*3*/{ /*4*/}/*5*/
5+
6+
const emptyCompletion = "/** */";
7+
const emptyIndent = 3;
8+
9+
goTo.marker("0");
10+
verify.DocCommentScaffolding(emptyCompletion, emptyIndent);
11+
12+
goTo.marker("1");
13+
verify.DocCommentScaffolding(emptyCompletion, emptyIndent);
14+
15+
goTo.marker("2");
16+
verify.DocCommentScaffolding(emptyCompletion, emptyIndent);
17+
18+
goTo.marker("3");
19+
verify.DocCommentScaffolding(emptyCompletion, emptyIndent);
20+
21+
goTo.marker("4");
22+
verify.DocCommentScaffolding(emptyCompletion, emptyIndent);
23+
24+
goTo.marker("5");
25+
verify.DocCommentScaffolding(emptyCompletion, emptyIndent);

0 commit comments

Comments
 (0)