add tests

* verified that new tests show no regressions against master
This commit is contained in:
Arthur Ozga 2017-09-19 17:56:34 -07:00
parent e3a720f863
commit 4b464ebca8
5 changed files with 135 additions and 0 deletions

View file

@ -0,0 +1,21 @@
/// <reference path="fourslash.ts"/>
//// function foo() {
//// [/*8_0*/1,2,3];
//// [1/*8_1*/,2,3];
//// [1,/*8_2*/2,3];
//// [
//// 1,/*8_3*/2,3];
//// [1,2,3/*8_4*/];
//// [
//// 1,2,3/*8_5*/];
//// [1,2,3]/*8_6*/;
//// [
//// 1,2,3]/*8_7*/;
//// }
for (let i = 0; i < 8; ++i) {
goTo.marker(`8_${i}`);
edit.insertLine("");
verify.indentationIs(8);
}

View file

@ -0,0 +1,37 @@
/// <reference path="fourslash.ts"/>
//// var v0 = /*4_0*/
//// 1;
////
//// let v1 = 1 /*4_1*/
//// + 10;
////
//// let v2 = 1 + /*4_2*/
//// 1;
////
//// let v3 = 1 + (function /*0_0*/(x: number, y: number) { return x || y; })(0, 1);
////
//// let v4 = 1 + (function (x: number, /*4_3*/y: number) { return x || y; })(0, 1);
////
//// let v5 = 1 + (function (x: number, y: number) { /*4_4*/return x || y; })(0, 1);
////
//// let v6 = 1 + (function (x: number, y: number) { return x || y;/*0_1*/})(0, 1);
////
//// let v7 = 1 + (function (x: number, y: number) {
//// return x || y;/*4_5*/
//// })(0, 1);
////
//// let v8 = 1 + (function (x: number, y: number) { return x || y; })(0, /*4_6*/1);
for (let i = 0; i < 2; ++i) {
goTo.marker(`0_${i}`);
edit.insertLine("");
verify.indentationIs(0);
}
for (let i = 0; i < 7; ++i) {
goTo.marker(`4_${i}`);
edit.insertLine("");
verify.indentationIs(4);
}

View file

@ -0,0 +1,16 @@
/// <reference path="fourslash.ts"/>
//// async function* foo() {
//// yield /*8_0*/await 1;
//// yield await /*8_1*/1;
//// yield
//// await /*8_2*/1;
//// yield await 1/*8_3*/;
//// }
for (let i = 0; i < 4; ++i) {
goTo.marker(`8_${i}`);
edit.insertLine("");
verify.indentationIs(8);
}

View file

@ -0,0 +1,31 @@
/// <reference path="fourslash.ts"/>
////function foo() {
//// let x: any;
//// x = /*8_0*/class { constructor(public x: number) { } };
//// x = class /*4_0*/{ constructor(public x: number) { } };
//// x = class { /*8_1*/constructor(public x: number) { } };
//// x = class { constructor(/*12_0*/public x: number) { } };
//// x = class { constructor(public /*12_1*/x: number) { } };
//// x = class { constructor(public x: number) {/*8_2*/ } };
//// x = class {
//// constructor(/*12_2*/public x: number) { }
//// };
//// x = class {
//// constructor(public x: number) {/*8_3*/ }
//// };
//// x = class {
//// constructor(public x: number) { }/*4_1*/};
////}
function verifyIndentation(level: number, count: number) {
for (let i = 0; i < count; ++i) {
goTo.marker(`${level}_${i}`);
edit.insertLine("");
verify.indentationIs(level);
}
}
verifyIndentation(4, 2);
verifyIndentation(8, 4);
verifyIndentation(12, 3);

View file

@ -0,0 +1,30 @@
/// <reference path="fourslash.ts"/>
//// function foo() {
//// {/*8_0*/x:1;y:2;z:3};
//// {x:1/*12_0*/;y:2;z:3};
//// {x:1;/*8_1*/y:2;z:3};
//// {
//// x:1;/*8_2*/y:2;z:3};
//// {x:1;y:2;z:3/*4_0*/};
//// {
//// x:1;y:2;z:3/*4_1*/};
//// {x:1;y:2;z:3}/*4_2*/;
//// {
//// x:1;y:2;z:3}/*4_3*/;
//// }
for (let i = 0; i < 4; ++i) {
goTo.marker(`4_${i}`);
edit.insertLine("");
verify.indentationIs(4);
}
for (let i = 0; i < 3; ++i) {
goTo.marker(`8_${i}`);
edit.insertLine("");
verify.indentationIs(8);
}
goTo.marker(`12_0`);
edit.insertLine("");
verify.indentationIs(12);