factor and simplify rel path test

This commit is contained in:
Arthur Ozga 2016-09-28 16:45:52 -07:00
parent 629e126718
commit f6ff6bd206
4 changed files with 145 additions and 101 deletions

View File

@ -0,0 +1,73 @@
/// <reference path='fourslash.ts' />
// Exercises completions for hidden files (ie: those beginning with '.')
// @Filename: f.ts
//// /*f1*/
// @Filename: d1/g.ts
//// /*g1*/
// @Filename: d1/d2/h.ts
//// /*h1*/
// @Filename: d1/d2/d3/i.ts
//// /// <reference path=".\..\..\/*28*/
// @Filename: test.ts
//// /// <reference path="/*0*/
//// /// <reference path=".//*1*/
//// /// <reference path=".\/*2*/
//// /// <reference path="./*3*/
//// /// <reference path="d1//*4*/
//// /// <reference path="d1/.//*5*/
//// /// <reference path="d1/.\/*6*/
//// /// <reference path="d1/./*7*/
//// /// <reference path="d1\/*8*/
//// /// <reference path="d1\.//*9*/
//// /// <reference path="d1\.\/*10*/
//// /// <reference path="d1\./*11*/
//// /// <reference path="d1/d2//*12*/
//// /// <reference path="d1/d2/.//*13*/
//// /// <reference path="d1/d2/.\/*14*/
//// /// <reference path="d1/d2/./*15*/
//// /// <reference path="d1/d2\/*16*/
//// /// <reference path="d1/d2\.//*17*/
//// /// <reference path="d1/d2\.\/*18*/
//// /// <reference path="d1/d2\./*19*/
//// /// <reference path="d1\d2//*20*/
//// /// <reference path="d1\d2/.//*21*/
//// /// <reference path="d1\d2/.\/*22*/
//// /// <reference path="d1\d2/./*23*/
//// /// <reference path="d1\d2\/*24*/
//// /// <reference path="d1\d2\.//*25*/
//// /// <reference path="d1\d2\.\/*26*/
//// /// <reference path="d1\d2\./*27*/
testBlock(0, 'f.ts', "d1");
testBlock(4, 'g.ts', "d2");
testBlock(8, 'g.ts', "d2");
testBlock(12, 'h.ts', "d3");
testBlock(16, 'h.ts', "d3");
testBlock(20, 'h.ts', "d3");
testBlock(24, 'h.ts', "d3");
goTo.marker("28");
verify.completionListContains("g.ts");
verify.completionListContains("d2");
verify.not.completionListItemsCountIsGreaterThan(2);
function testBlock(offset: number, fileName: string, dir: string) {
for (let m = offset; m < offset + 3; ++m) {
goTo.marker("" + m);
verify.completionListContains(fileName);
verify.completionListContains(dir);
verify.not.completionListItemsCountIsGreaterThan(2);
}
goTo.marker("" + (offset + 3));
verify.not.completionListItemsCountIsGreaterThan(0);
}

View File

@ -0,0 +1,21 @@
/// <reference path='fourslash.ts' />
// Exercises relative path completions going up and down 2 directories
// and the use of forward- and back-slashes and combinations thereof.
// @Filename: f1.ts
//// /*f1*/
// @Filename: f2.ts
//// /*f2*/
// @Filename: test.ts
//// /// <reference path="f/*0*/
//// /// <reference path="f1/*1*/
//// /// <reference path="f1./*2*/
//// /// <reference path="f1.t/*3*/
//// /// <reference path="./f/*4*/
//// /// <reference path="./f1/*5*/
//// /// <reference path="./f1./*6*/
//// /// <reference path="./f1.t/*7*/

View File

@ -2,10 +2,8 @@
// Exercises completions for hidden files (ie: those beginning with '.')
// @Filename: f1.ts
//// /*f1*/
// @Filename: f2.ts
//// /*f2*/
// @Filename: f.ts
//// /*f*/
// @Filename: .hidden.ts
//// /*hidden*/
@ -17,8 +15,7 @@
for(let m of ["0", "2", "3"]) {
goTo.marker(m);
verify.completionListContains("f1.ts");
verify.completionListContains("f2.ts");
verify.completionListContains("f.ts");
verify.completionListContains(".hidden.ts");
verify.not.completionListItemsCountIsGreaterThan(3);
}

View File

@ -3,131 +3,84 @@
// Exercises relative path completions going up and down 2 directories
// and the use of forward- and back-slashes and combinations thereof.
// @Filename: f1.ts
// @Filename: f.ts
//// /*f1*/
// @Filename: f2.ts
//// /*f2*/
// @Filename: dir1/g1.ts
// @Filename: d1/g.ts
//// /*g1*/
// @Filename: dir1/g2.ts
//// /*g2*/
// @Filename: dir1/dir2/h1.ts
// @Filename: d1/d2/h.ts
//// /*h1*/
// @Filename: dir1/dir2/h2.ts
//// /*h2*/
// @Filename: dir1/dir2/dir3/i1.ts
// @Filename: d1/d2/d3/i.ts
//// /*i1*/
// @Filename: dir1/dir2/dir3/i2.ts
//// /*i2*/
// @Filename: dir1/dir2/dir3/dir4/j1.ts
// @Filename: d1/d2/d3/d4/j.ts
//// /*j1*/
// @Filename: dir1/dir2/dir3/dir4/j2.ts
//// /*j2*/
// @Filename: dir1/dir2/test.ts
// @Filename: d1/d2/test.ts
//// /// <reference path="/*0*/
//// /// <reference path="./*1*/
//// /// <reference path="../*2*/
//// /// <reference path=".//*1*/
//// /// <reference path="..//*3*/
//// /// <reference path="..\/*4*/
//// /// <reference path="../..//*5*/
//// /// <reference path="../..\/*6*/
//// /// <reference path="..\..//*7*/
//// /// <reference path="..\..\/*8*/
//// /// <reference path="./*2*/
//// /// <reference path="../*3*/
//// /// <reference path=".//*9*/
//// /// <reference path=".\/*10*/
//// /// <reference path="./h/*11*/
//// /// <reference path=".\h/*12*/
//// /// <reference path="./h1/*13*/
//// /// <reference path=".\h1/*14*/
//// /// <reference path="./h1./*15*/
//// /// <reference path=".\h1./*16*/
//// /// <reference path="./h1.t/*17*/
//// /// <reference path=".\h1.t/*18*/
//// /// <reference path="..//4*/
//// /// <reference path="..\/*5*/
//// /// <reference path="dir3/*19*/
//// /// <reference path="dir3//*20*/
//// /// <reference path="dir3\/*21*/
//// /// <reference path="./dir3//*22*/
//// /// <reference path=".\dir3\/*23*/
//// /// <reference path="dir3/dir4//*24*/
//// /// <reference path="dir3\dir4\/*25*/
//// /// <reference path="./dir3/dir4//*26*/
//// /// <reference path=".\dir3\dir4\/*27*/
//// /// <reference path="../..//*6*/
//// /// <reference path="d3/*7*/
//// /// <reference path="d3//*8*/
//// /// <reference path="./d3//*9*/
//// /// <reference path="d3/d4//*10*/
//// /// <reference path="./d3/d4//*11*/
workingDirCompletions();
parentDirCompletions();
childDirCompletions();
function workingDirCompletions() {
for (let m of ["0", "9", "10"]) {
for (let m of ["0", "1",]) {
goTo.marker(m);
verify.completionListContains("h1.ts");
verify.completionListContains("h2.ts");
verify.completionListContains("dir3");
verify.not.completionListItemsCountIsGreaterThan(3);
}
goTo.marker("1");
verify.not.completionListItemsCountIsGreaterThan(0);
goTo.marker("2");
verify.not.completionListItemsCountIsGreaterThan(0);
for (let m of ["11", "12"]) {
goTo.marker(m);
verify.completionListContains("h1.ts");
verify.completionListContains("h2.ts");
verify.completionListContains("h.ts");
verify.completionListContains("d3");
verify.not.completionListItemsCountIsGreaterThan(2);
}
for (let m of ["13", "14", "15", "16", "17", "18"]) {
for(let m of ["2", "3"]) {
goTo.marker(m);
verify.completionListContains("h1.ts");
verify.not.completionListItemsCountIsGreaterThan(1);
verify.not.completionListItemsCountIsGreaterThan(0);
}
goTo.marker("19");
verify.completionListContains("dir3");
verify.not.completionListItemsCountIsGreaterThan(1);
}
function parentDirCompletions() {
for (let m of ["3", "4"]) {
for (let m of ["4", "5"]) {
goTo.marker(m);
verify.completionListContains("g1.ts");
verify.completionListContains("g2.ts");
verify.completionListContains("dir2");
verify.not.completionListItemsCountIsGreaterThan(3);
verify.completionListContains("g.ts");
verify.completionListContains("d2");
verify.not.completionListItemsCountIsGreaterThan(2);
}
for (let m of ["5", "6", "7", "8"]) {
goTo.marker(m);
verify.completionListContains("f1.ts");
verify.completionListContains("f2.ts");
verify.completionListContains("dir1");
verify.not.completionListItemsCountIsGreaterThan(3);
}
goTo.marker("6");
verify.completionListContains("f.ts");
verify.completionListContains("d1");
verify.not.completionListItemsCountIsGreaterThan(2);
}
function childDirCompletions() {
for (let m of ["20", "21", "22", "23"]) {
goTo.marker(m);
verify.completionListContains("i1.ts");
verify.completionListContains("i2.ts");
verify.completionListContains("dir4");
verify.not.completionListItemsCountIsGreaterThan(3);
}
goTo.marker("7");
verify.not.completionListItemsCountIsGreaterThan(0);
for (let m of ["24", "25", "26", "27"]) {
for (let m of ["8", "9"]) {
goTo.marker(m);
verify.completionListContains("j1.ts");
verify.completionListContains("j2.ts");
verify.completionListContains("i.ts");
verify.completionListContains("d4");
verify.not.completionListItemsCountIsGreaterThan(2);
}
}
workingDirCompletions();
parentDirCompletions();
childDirCompletions();
for (let m of ["10", "11"]) {
goTo.marker(m);
verify.completionListContains("j.ts");
verify.not.completionListItemsCountIsGreaterThan(1);
}
}