Permalink
Browse files

Add "js" extension gaurd to compare / comment test

  • Loading branch information...
Constellation committed Jul 17, 2012
1 parent ddc4cd5 commit 8893f0fd73738a749e764dba6f0281dd313553c1
Showing with 24 additions and 20 deletions.
  1. +12 −10 test/comment.js
  2. +12 −10 test/compare.js
View
@@ -102,16 +102,18 @@
tick = new Date();
fs.readdirSync(__dirname + '/comment').sort().forEach(function(file) {
var code, expected, p;
- if (!/expected\.js$/.test(file)) {
- p = file.replace(/\.js$/, '.expected.js');
- total += 1;
- code = fs.readFileSync(__dirname + '/comment/' + file, 'utf-8');
- expected = fs.readFileSync(__dirname + '/comment/' + p, 'utf-8');
- try {
- test(code, expected);
- } catch (e) {
- e.source = code;
- failures.push(e);
+ if (/\.js$/.test(file)) {
+ if (!/expected\.js$/.test(file)) {
+ p = file.replace(/\.js$/, '.expected.js');
+ total += 1;
+ code = fs.readFileSync(__dirname + '/comment/' + file, 'utf-8');
+ expected = fs.readFileSync(__dirname + '/comment/' + p, 'utf-8');
+ try {
+ test(code, expected);
+ } catch (e) {
+ e.source = code;
+ failures.push(e);
+ }
}
}
});
View
@@ -91,16 +91,18 @@
tick = new Date();
fs.readdirSync(__dirname + '/compare').sort().forEach(function(file) {
var code, expected, p;
- if (!/expected\.js$/.test(file)) {
- p = file.replace(/\.js$/, '.expected.js');
- total += 1;
- code = fs.readFileSync(__dirname + '/compare/' + file, 'utf-8');
- expected = fs.readFileSync(__dirname + '/compare/' + p, 'utf-8');
- try {
- test(code, expected);
- } catch (e) {
- e.source = code;
- failures.push(e);
+ if (/\.js$/.test(file)) {
+ if (!/expected\.js$/.test(file)) {
+ p = file.replace(/\.js$/, '.expected.js');
+ total += 1;
+ code = fs.readFileSync(__dirname + '/compare/' + file, 'utf-8');
+ expected = fs.readFileSync(__dirname + '/compare/' + p, 'utf-8');
+ try {
+ test(code, expected);
+ } catch (e) {
+ e.source = code;
+ failures.push(e);
+ }
}
}
});

0 comments on commit 8893f0f

Please sign in to comment.