Commit 19fb42e9 19fb42e9d9000e8be0d4c5b067d276d521fb1644 by Nicolas Perriault

fixes invalid sort function in Tester.findTestFiles()

1 parent 9f223cf7
......@@ -394,9 +394,7 @@ var Tester = function(casper, options) {
});
return entries.filter(function(entry) {
return utils.isJsFile(fs.absolute(fs.pathJoin(dir, entry)));
}).sort(function(a, b) {
return a > b;
});
}).sort();
};
/**
......
var fs = require('fs');
var t = casper.test;
t.comment('Tester.testEquals()');
......@@ -24,4 +26,17 @@ t.assertNot(t.testEquals({1:{name:"bob",age:28}, 2:{name:"john",age:26}}, {1:{na
t.assert(t.testEquals(function(x){return x;}, function(x){return x;}), 'Tester.testEquals() function equality');
t.assertNot(t.testEquals(function(x){return x;}, function(y){return y+2;}), 'Tester.testEquals() function inequality');
t.comment('Tester.sortFiles()');
var files = t.findTestFiles(fs.pathJoin(phantom.casperPath, 'tests', 'testdir'));
t.assertEquals(files, [
"/Users/niko/Sites/casperjs/tests/testdir/01_a/abc.js",
"/Users/niko/Sites/casperjs/tests/testdir/01_a/def.js",
"/Users/niko/Sites/casperjs/tests/testdir/02_b/ABC.js",
"/Users/niko/Sites/casperjs/tests/testdir/02_b/abc.js",
"/Users/niko/Sites/casperjs/tests/testdir/03_a.js",
"/Users/niko/Sites/casperjs/tests/testdir/03_b.js",
"/Users/niko/Sites/casperjs/tests/testdir/04/01_init.js",
"/Users/niko/Sites/casperjs/tests/testdir/04/02_do.js"
], 'findTestFiles() find test files and sort them');
t.done();
......
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed