Skip to content

Commit 62f16be

Browse files
committed
add tests
1 parent 4b9f5a0 commit 62f16be

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// // /*0_0*/
4+
//// /* /*0_1*/
5+
//// some text /*0_2*/
6+
//// some text /*1_0*/
7+
//// * some text /*0_3*/
8+
//// /*0_4*/
9+
//// */
10+
//// function foo() {
11+
//// // /*4_0*/
12+
//// /** /*4_1*/
13+
//// * /*4_2*/
14+
//// * /*4_3*/
15+
//// /*7_0*/
16+
//// */
17+
//// /* /*4_4*/ */
18+
//// }
19+
20+
for (let i = 0; i < 5; ++i) {
21+
goTo.marker(`0_${i}`);
22+
verify.indentationIs(0);
23+
24+
goTo.marker(`4_${i}`);
25+
verify.indentationIs(4);
26+
}
27+
28+
goTo.marker(`1_0`);
29+
verify.indentationIs(1);
30+
31+
goTo.marker(`7_0`);
32+
verify.indentationIs(7);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @Filename: file.jsx
4+
//// `
5+
//// // /*0*/
6+
//// /* /*1*/ */
7+
//// /**
8+
//// * /*2*/
9+
//// */
10+
//// foo()
11+
//// // /*3*/
12+
//// /* /*4*/ */
13+
//// /**
14+
//// * /*5*/
15+
//// */
16+
//// `
17+
//// `
18+
//// // /*6*/
19+
//// /* /*7*/ */
20+
//// /**
21+
//// * /*8*/
22+
//// */
23+
24+
for (let i = 0; i < 9; ++i) {
25+
goTo.marker(i.toString());
26+
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ false);
27+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//// /* x */
4+
//// /**
5+
//// * @param this doesn't make sense here.
6+
//// */
7+
//// // x
8+
9+
const firstCommentStart = 0;
10+
const firstCommentEnd = 7;
11+
goTo.position(firstCommentStart);
12+
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ true);
13+
14+
goTo.position(firstCommentStart + 1);
15+
verify.isInCommentAtPosition(/*onlyMultiLine*/ true);
16+
goTo.position(firstCommentEnd - 1);
17+
verify.isInCommentAtPosition(/*onlyMultiLine*/ true);
18+
19+
goTo.position(firstCommentEnd);
20+
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ true);
21+
22+
const multilineJsDocStart = firstCommentEnd + 1;
23+
const multilineJsDocEnd = multilineJsDocStart + 49;
24+
25+
goTo.position(multilineJsDocStart);
26+
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ true);
27+
goTo.position(multilineJsDocStart + 1);
28+
verify.isInCommentAtPosition(/*onlyMultiLine*/ true);
29+
goTo.position(multilineJsDocEnd - 1);
30+
verify.isInCommentAtPosition(/*onlyMultiLine*/ true);
31+
goTo.position(multilineJsDocEnd);
32+
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ true);
33+
34+
const singleLineCommentStart = multilineJsDocEnd + 1;
35+
36+
goTo.position(singleLineCommentStart + 1);
37+
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ true);
38+
verify.isInCommentAtPosition(/*onlyMultiLine*/ false);

0 commit comments

Comments
 (0)