mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Added accumulated tests.
This commit is contained in:
parent
6a6839a1b3
commit
577c12e42e
17
tests/cases/fourslash/smartIndentAfterNewExpression.ts
Normal file
17
tests/cases/fourslash/smartIndentAfterNewExpression.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////
|
||||
////new Array
|
||||
////{| "indent": 0 |}
|
||||
////new Array;
|
||||
////{| "indent": 0 |}
|
||||
////new Array(0);
|
||||
////{| "indent": 0 |}
|
||||
////new Array(;
|
||||
////{| "indent": 0 |}
|
||||
////new Array(
|
||||
////{| "indent": 4 |}
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
|
||||
});
|
||||
@ -0,0 +1,13 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////var x = (/*1*/1/*2*/)/*3*/
|
||||
|
||||
function verifyIndentationAfterNewLine(marker: string, indentation: number): void {
|
||||
goTo.marker(marker);
|
||||
edit.insert("\r\n");
|
||||
verify.indentationIs(indentation);
|
||||
}
|
||||
|
||||
verifyIndentationAfterNewLine("1", 4);
|
||||
verifyIndentationAfterNewLine("2", 4);
|
||||
verifyIndentationAfterNewLine("3", 0);
|
||||
@ -0,0 +1,8 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////var y = (
|
||||
////{| "indent": 4 |}
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
|
||||
});
|
||||
36
tests/cases/fourslash/smartIndentOnAccessors.ts
Normal file
36
tests/cases/fourslash/smartIndentOnAccessors.ts
Normal file
@ -0,0 +1,36 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////class Foo {
|
||||
//// get foo(a,
|
||||
//// /*1*/b,/*0*/
|
||||
//// //comment/*2*/
|
||||
//// /*3*/c
|
||||
//// ) {
|
||||
//// }
|
||||
//// set foo(a,
|
||||
//// /*5*/b,/*4*/
|
||||
//// //comment/*6*/
|
||||
//// /*7*/c
|
||||
//// ) {
|
||||
//// }
|
||||
////}
|
||||
|
||||
|
||||
goTo.marker("0");
|
||||
edit.insert("\r\n");
|
||||
verify.indentationIs(8);
|
||||
goTo.marker("1");
|
||||
verify.currentLineContentIs(" b,");
|
||||
goTo.marker("2");
|
||||
verify.currentLineContentIs(" //comment");
|
||||
goTo.marker("3");
|
||||
verify.currentLineContentIs(" c");
|
||||
goTo.marker("4");
|
||||
edit.insert("\r\n");
|
||||
verify.indentationIs(8);
|
||||
goTo.marker("5");
|
||||
verify.currentLineContentIs(" b,");
|
||||
goTo.marker("6");
|
||||
verify.currentLineContentIs(" //comment");
|
||||
goTo.marker("7");
|
||||
verify.currentLineContentIs(" c");
|
||||
36
tests/cases/fourslash/smartIndentOnAccessors01.ts
Normal file
36
tests/cases/fourslash/smartIndentOnAccessors01.ts
Normal file
@ -0,0 +1,36 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////class Foo {
|
||||
//// get foo(a,
|
||||
//// /*1*/b,/*0*/
|
||||
//// //comment/*2*/
|
||||
//// /*3*/c
|
||||
//// ) {
|
||||
//// }
|
||||
//// set foo(a,
|
||||
//// /*5*/b,/*4*/
|
||||
//// //comment/*6*/
|
||||
//// /*7*/c
|
||||
//// ) {
|
||||
//// }
|
||||
////}
|
||||
|
||||
|
||||
goTo.marker("0");
|
||||
edit.insert("\r\n");
|
||||
verify.indentationIs(8);
|
||||
goTo.marker("1");
|
||||
verify.currentLineContentIs(" b,");
|
||||
goTo.marker("2");
|
||||
verify.currentLineContentIs(" //comment");
|
||||
goTo.marker("3");
|
||||
verify.currentLineContentIs(" c");
|
||||
goTo.marker("4");
|
||||
edit.insert("\r\n");
|
||||
verify.indentationIs(8);
|
||||
goTo.marker("5");
|
||||
verify.currentLineContentIs(" b,");
|
||||
goTo.marker("6");
|
||||
verify.currentLineContentIs(" //comment");
|
||||
goTo.marker("7");
|
||||
verify.currentLineContentIs(" c");
|
||||
9
tests/cases/fourslash/smartIndentOnAccessors02.ts
Normal file
9
tests/cases/fourslash/smartIndentOnAccessors02.ts
Normal file
@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////class Foo {
|
||||
//// get foo() {
|
||||
////{| "indent": 8 |}
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
|
||||
});
|
||||
@ -0,0 +1,8 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////var x: () => {
|
||||
////{| "indent": 4 |}
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
|
||||
});
|
||||
@ -0,0 +1,11 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////var x = {
|
||||
//// [1123123123132
|
||||
////{| "indent": 4 |}
|
||||
////}
|
||||
|
||||
// Note that we currently do NOT indent further in a computed property.
|
||||
test.markers().forEach(marker => {
|
||||
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
|
||||
});
|
||||
@ -0,0 +1,8 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////var x: new () => {
|
||||
////{| "indent": 4 |}
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
|
||||
});
|
||||
@ -0,0 +1,13 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////function /*1*/f/*2*/
|
||||
|
||||
|
||||
function verifyIndentationAfterNewLine(marker: string, indentation: number): void {
|
||||
goTo.marker(marker);
|
||||
edit.insert("\r\n");
|
||||
verify.indentationIs(indentation);
|
||||
}
|
||||
|
||||
verifyIndentationAfterNewLine("1", 4);
|
||||
verifyIndentationAfterNewLine("2", 4);
|
||||
@ -0,0 +1,14 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////function f</*1*/A/*2*/,B/*3*/
|
||||
|
||||
|
||||
function verifyIndentationAfterNewLine(marker: string, indentation: number): void {
|
||||
goTo.marker(marker);
|
||||
edit.insert("\r\n");
|
||||
verify.indentationIs(indentation);
|
||||
}
|
||||
|
||||
verifyIndentationAfterNewLine("1", 4);
|
||||
verifyIndentationAfterNewLine("2", 4);
|
||||
verifyIndentationAfterNewLine("3", 4);
|
||||
@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////function f<A,B,C>/*1*/
|
||||
|
||||
|
||||
function verifyIndentationAfterNewLine(marker: string, indentation: number): void {
|
||||
goTo.marker(marker);
|
||||
edit.insert("\r\n");
|
||||
verify.indentationIs(indentation);
|
||||
}
|
||||
|
||||
verifyIndentationAfterNewLine("1", 4);
|
||||
@ -0,0 +1,17 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////function f<A,B,C>/*1*/(/*2*/a: A, /*3*/b:/*4*/B, c/*5*/, d: C/*6*/
|
||||
|
||||
|
||||
function verifyIndentationAfterNewLine(marker: string, indentation: number): void {
|
||||
goTo.marker(marker);
|
||||
edit.insert("\r\n");
|
||||
verify.indentationIs(indentation);
|
||||
}
|
||||
|
||||
verifyIndentationAfterNewLine("1", 4);
|
||||
verifyIndentationAfterNewLine("2", 4);
|
||||
verifyIndentationAfterNewLine("3", 4);
|
||||
verifyIndentationAfterNewLine("4", 4);
|
||||
verifyIndentationAfterNewLine("5", 4);
|
||||
verifyIndentationAfterNewLine("6", 4);
|
||||
@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////function f<A,B,C>(a: A, b:B, c, d: C): {
|
||||
////{| "indent": 4 |}
|
||||
////
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
|
||||
});
|
||||
@ -0,0 +1,10 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////function f<A,B,C>(a: A, b:B, c, d: C): {
|
||||
////{| "indent": 4 |}
|
||||
////} {
|
||||
////{| "indent": 4 |}
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
|
||||
});
|
||||
@ -0,0 +1,11 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////class C {
|
||||
////[x: string
|
||||
////{| "indent": 4 |}
|
||||
////
|
||||
|
||||
// Note that we currently do NOT indent further in an index signature.
|
||||
test.markers().forEach(marker => {
|
||||
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
|
||||
});
|
||||
@ -0,0 +1,8 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////var x: {
|
||||
////{| "indent": 4 |}
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
|
||||
});
|
||||
@ -0,0 +1,8 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////var x: [string, number,
|
||||
////{| "indent": 4 |}
|
||||
|
||||
test.markers().forEach(marker => {
|
||||
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user