mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 20:14:01 -06:00
add tests
This commit is contained in:
parent
4b9f5a0f8f
commit
62f16bee55
32
tests/cases/fourslash/indentationInComments.ts
Normal file
32
tests/cases/fourslash/indentationInComments.ts
Normal file
@ -0,0 +1,32 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// // /*0_0*/
|
||||
//// /* /*0_1*/
|
||||
//// some text /*0_2*/
|
||||
//// some text /*1_0*/
|
||||
//// * some text /*0_3*/
|
||||
//// /*0_4*/
|
||||
//// */
|
||||
//// function foo() {
|
||||
//// // /*4_0*/
|
||||
//// /** /*4_1*/
|
||||
//// * /*4_2*/
|
||||
//// * /*4_3*/
|
||||
//// /*7_0*/
|
||||
//// */
|
||||
//// /* /*4_4*/ */
|
||||
//// }
|
||||
|
||||
for (let i = 0; i < 5; ++i) {
|
||||
goTo.marker(`0_${i}`);
|
||||
verify.indentationIs(0);
|
||||
|
||||
goTo.marker(`4_${i}`);
|
||||
verify.indentationIs(4);
|
||||
}
|
||||
|
||||
goTo.marker(`1_0`);
|
||||
verify.indentationIs(1);
|
||||
|
||||
goTo.marker(`7_0`);
|
||||
verify.indentationIs(7);
|
||||
@ -0,0 +1,27 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: file.jsx
|
||||
//// `
|
||||
//// // /*0*/
|
||||
//// /* /*1*/ */
|
||||
//// /**
|
||||
//// * /*2*/
|
||||
//// */
|
||||
//// foo()
|
||||
//// // /*3*/
|
||||
//// /* /*4*/ */
|
||||
//// /**
|
||||
//// * /*5*/
|
||||
//// */
|
||||
//// `
|
||||
//// `
|
||||
//// // /*6*/
|
||||
//// /* /*7*/ */
|
||||
//// /**
|
||||
//// * /*8*/
|
||||
//// */
|
||||
|
||||
for (let i = 0; i < 9; ++i) {
|
||||
goTo.marker(i.toString());
|
||||
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ false);
|
||||
}
|
||||
38
tests/cases/fourslash/isInMultiLineCommentOnlyTrivia.ts
Normal file
38
tests/cases/fourslash/isInMultiLineCommentOnlyTrivia.ts
Normal file
@ -0,0 +1,38 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//// /* x */
|
||||
//// /**
|
||||
//// * @param this doesn't make sense here.
|
||||
//// */
|
||||
//// // x
|
||||
|
||||
const firstCommentStart = 0;
|
||||
const firstCommentEnd = 7;
|
||||
goTo.position(firstCommentStart);
|
||||
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ true);
|
||||
|
||||
goTo.position(firstCommentStart + 1);
|
||||
verify.isInCommentAtPosition(/*onlyMultiLine*/ true);
|
||||
goTo.position(firstCommentEnd - 1);
|
||||
verify.isInCommentAtPosition(/*onlyMultiLine*/ true);
|
||||
|
||||
goTo.position(firstCommentEnd);
|
||||
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ true);
|
||||
|
||||
const multilineJsDocStart = firstCommentEnd + 1;
|
||||
const multilineJsDocEnd = multilineJsDocStart + 49;
|
||||
|
||||
goTo.position(multilineJsDocStart);
|
||||
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ true);
|
||||
goTo.position(multilineJsDocStart + 1);
|
||||
verify.isInCommentAtPosition(/*onlyMultiLine*/ true);
|
||||
goTo.position(multilineJsDocEnd - 1);
|
||||
verify.isInCommentAtPosition(/*onlyMultiLine*/ true);
|
||||
goTo.position(multilineJsDocEnd);
|
||||
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ true);
|
||||
|
||||
const singleLineCommentStart = multilineJsDocEnd + 1;
|
||||
|
||||
goTo.position(singleLineCommentStart + 1);
|
||||
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ true);
|
||||
verify.isInCommentAtPosition(/*onlyMultiLine*/ false);
|
||||
Loading…
x
Reference in New Issue
Block a user