test: style consistency changes and simplify quotes
authorXhmikosR <xhmikosr@users.sourceforge.net>
Mon, 18 Mar 2013 18:09:33 +0000 (20:09 +0200)
committerXhmikosR <xhmikosr@users.sourceforge.net>
Sat, 23 Mar 2013 10:03:13 +0000 (12:03 +0200)
test/batch-test.js
test/bench.js
test/binary-test.js
test/unit-test.js

index 7e0de08..98177e2 100644 (file)
@@ -10,7 +10,8 @@ var batchContexts = function() {
   var context = {};
   var dir = path.join(__dirname, 'data');
   fs.readdirSync(dir).forEach(function(filename) {
-    if (/min.css$/.exec(filename) || !fs.statSync(path.join(dir, filename)).isFile()) return;
+    if (/min.css$/.exec(filename) || !fs.statSync(path.join(dir, filename)).isFile())
+      return;
     var testName = filename.split('.')[0];
 
     context[testName] = {
index e6bf059..196aaec 100644 (file)
@@ -2,7 +2,7 @@ var cleanCSS = require('../index'),
   bigcss = require('fs').readFileSync(require('path').join(__dirname, 'data', 'big.css'), 'utf8');
 
 if (!process.hrtime) {
-  console.log("process.hrtime() (node > 0.7.6) is required for benchmarking");
+  console.log('process.hrtime() (node.js > 0.7.6) is required for benchmarking');
   process.exit(1);
 }
 
@@ -10,4 +10,4 @@ var start = process.hrtime();
 cleanCSS.process(bigcss, { debug: true });
 
 var itTook = process.hrtime(start);
-console.log('complete minification: %d ms', 1000 * itTook[0] + itTook[1] / 1000000.0);
\ No newline at end of file
+console.log('complete minification: %d ms', 1000 * itTook[0] + itTook[1] / 1000000.0);
index 7b13e62..fd43103 100644 (file)
@@ -12,7 +12,7 @@ var binaryContext = function(options, context) {
 
   context.topic = function() {
     // We add __DIRECT__=1 to force binary into 'non-piped' mode
-    exec("__DIRECT__=1 ./bin/cleancss " + options, this.callback);
+    exec('__DIRECT__=1 ./bin/cleancss ' + options, this.callback);
   };
   return context;
 };
@@ -22,7 +22,7 @@ var pipedContext = function(css, options, context) {
     return {};
 
   context.topic = function() {
-    exec("echo \"" + css + "\" | ./bin/cleancss " + options, this.callback);
+    exec('echo "' + css + '" | ./bin/cleancss ' + options, this.callback);
   };
   return context;
 };
@@ -94,7 +94,7 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({
       assert.equal(stdout, minimized);
     }
   }),
-  'to file': binaryContext('-o reset-min.css ./test/data/reset.css', {
+  'to file': binaryContext('-o ./reset-min.css ./test/data/reset.css', {
     'should give no output': function(error, stdout) {
       assert.equal(stdout, '');
     },
@@ -105,9 +105,9 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({
     },
     teardown: function() {
       if (isWindows)
-        exec('del /q /f reset-min.css');
+        exec('del /q /f ./reset-min.css');
       else
-        exec('rm reset-min.css');
+        exec('rm ./reset-min.css');
     }
   })
-});
\ No newline at end of file
+});
index 2baee8c..06ae154 100644 (file)
@@ -14,10 +14,10 @@ var cssContext = function(groups, options) {
 
   for (var g in groups) {
     var transformation = groups[g];
-    if (typeof transformation == 'string') transformation = [transformation, transformation];
-    if (!transformation[0].push) {
+    if (typeof transformation == 'string')
+      transformation = [transformation, transformation];
+    if (!transformation[0].push)
       transformation = [[transformation[0], transformation[1]]];
-    }
 
     for (var i = 0, c = transformation.length; i < c; i++) {
       context[g + ' #' + (i + 1)] = {