Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
Add additional test cases
Browse files Browse the repository at this point in the history
- Added test case with incrmentor in body of loop
- Added test case with += incrementor
  • Loading branch information
rwaskiewicz committed May 3, 2018
1 parent eebadbc commit 187bc3d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion test/rules/prefer-while/test.ts.fix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ while (true===true) {
console.log(x);
}

// for loops with an initializer, termination condition, and incrementor should remain untouched
// for loops with an initializer, termination condition, and incrementor using '++' should remain untouched
for(let x = 1; x < 10; x++) {
console.log(x);
}

// for loops with an initializer, termination condition, and incrementor using '+=' should remain untouched
for (let i = 0; i < 10; x+=1) {
console.log(x);
}

// for loops with an initializer and termination condition should remain untouched
for (let i = 0; i < 10;) {
i += 1;
}
12 changes: 11 additions & 1 deletion test/rules/prefer-while/test.ts.lint
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ for(;true===true;) {
console.log(x);
}

// for loops with an initializer, termination condition, and incrementor should remain untouched
// for loops with an initializer, termination condition, and incrementor using '++' should remain untouched
for(let x = 1; x < 10; x++) {
console.log(x);
}

// for loops with an initializer, termination condition, and incrementor using '+=' should remain untouched
for (let i = 0; i < 10; x+=1) {
console.log(x);
}

// for loops with an initializer and termination condition should remain untouched
for (let i = 0; i < 10;) {
i += 1;
}

0 comments on commit 187bc3d

Please sign in to comment.