Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added test cases for shuffle and sorts that promise unique output #56

Merged
merged 1 commit into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fixtures/shuffled_lowercase_expected/sortLines
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ bb
c
cc
d
dd
dd
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ bb
c
cc
d
dd
dd
1 change: 1 addition & 0 deletions fixtures/shuffled_lowercase_expected/sortLinesLineLength
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ a
cc
aa
bb
dd
dd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cc
aa
bb
dd
dd
d
c
b
Expand Down
1 change: 1 addition & 0 deletions fixtures/shuffled_lowercase_expected/sortLinesNatural
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ bb
c
cc
d
dd
dd
1 change: 1 addition & 0 deletions fixtures/shuffled_lowercase_expected/sortLinesReverse
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dd
dd
d
cc
c
Expand Down
9 changes: 9 additions & 0 deletions fixtures/shuffled_lowercase_expected/sortLinesShuffle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dd
dd
a
bb
b
c
aa
d
cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ a
cc
aa
bb
dd
dd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dd
dd
bb
aa
cc
Expand Down
1 change: 1 addition & 0 deletions fixtures/shuffled_lowercase_fixture
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ c
b
bb
a
dd
dd
1 change: 1 addition & 0 deletions fixtures/variables_expected/sortLines
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var test10 = 1;
var test100 = 100;
var test2 = 1221134;
var test2 = 1221134;
1 change: 1 addition & 0 deletions fixtures/variables_expected/sortLinesCaseInsensitive
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var test10 = 1;
var test100 = 100;
var test2 = 1221134;
var test2 = 1221134;
1 change: 1 addition & 0 deletions fixtures/variables_expected/sortLinesLineLength
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var test10 = 1;
var test100 = 100;
var test2 = 1221134;
var test2 = 1221134;
1 change: 1 addition & 0 deletions fixtures/variables_expected/sortLinesLineLengthReverse
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var test2 = 1221134;
var test2 = 1221134;
var test100 = 100;
var test10 = 1;
1 change: 1 addition & 0 deletions fixtures/variables_expected/sortLinesNatural
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var test2 = 1221134;
var test2 = 1221134;
var test10 = 1;
var test100 = 100;
1 change: 1 addition & 0 deletions fixtures/variables_expected/sortLinesReverse
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var test2 = 1221134;
var test2 = 1221134;
var test100 = 100;
var test10 = 1;
4 changes: 4 additions & 0 deletions fixtures/variables_expected/sortLinesShuffle
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var test2 = 1221134;
var test100 = 100;
var test2 = 1221134;
var test10 = 1;
1 change: 1 addition & 0 deletions fixtures/variables_expected/sortLinesVariableLength
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var test2 = 1221134;
var test2 = 1221134;
var test10 = 1;
var test100 = 100;
1 change: 1 addition & 0 deletions fixtures/variables_expected/sortLinesVariableLengthReverse
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var test100 = 100;
var test10 = 1;
var test2 = 1221134;
var test2 = 1221134;
3 changes: 2 additions & 1 deletion fixtures/variables_fixture
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var test10 = 1;
var test2 = 1221134;
var test100 = 100;
var test100 = 100;
var test2 = 1221134;
5 changes: 3 additions & 2 deletions src/test/sort-lines.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ function getAllText(document: TextDocument): string {
const fixtureDir = path.join(__dirname, '..', '..', 'fixtures');
const fixtures = fs.readdirSync(fixtureDir).filter(v => v.search('_fixture$') !== -1).map(f => f.replace('_fixture', ''));
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'package.json'), 'utf8'));
const nonDeterministicCommands = ['sortLinesShuffle'];
const extCommands: string[] = packageJson.contributes.commands.map(c => c.command.replace('sortLines.', '')).filter(c => nonDeterministicCommands.indexOf(c) === -1);
const extCommands: string[] = packageJson.contributes.commands.map(c => c.command.replace('sortLines.', ''));
const expectedExists: { [fixture: string]: { [command: string]: boolean } } = {};

Math.random = function(): 0.9 { return 0.9; };

suite('Sort Lines', () => {
suite('All command fixtures exist', () => {
fixtures.forEach(fixture => {
Expand Down