Replaces remaining references to line breaks with require('os').EOL.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Sun, 12 Oct 2014 15:21:22 +0000 (16:21 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Sun, 12 Oct 2014 15:24:34 +0000 (16:24 +0100)
* Thanks @XhmikosR!

test/batch-test.js
test/binary-test.js
test/integration-test.js

index 7fdc44d..e550398 100644 (file)
@@ -4,7 +4,7 @@ var fs = require('fs');
 var assert = require('assert');
 var CleanCSS = require('../index');
 
-var lineBreak = process.platform == 'win32' ? /\r\n/g : /\n/g;
+var lineBreak = require('os').EOL;
 
 var batchContexts = function() {
   var context = {};
index d139978..f36e874 100644 (file)
@@ -6,7 +6,7 @@ var http = require('http');
 var path = require('path');
 
 var isWindows = process.platform == 'win32';
-var lineBreak = isWindows ? /\r\n/g : /\n/g;
+var lineBreakRegExp = new RegExp(require('os').EOL, 'g');
 
 var binaryContext = function(options, context) {
   if (isWindows)
@@ -34,7 +34,7 @@ var unixOnlyContext = function(context) {
 };
 
 var readFile = function(filename) {
-  return fs.readFileSync(filename, { encoding: 'utf-8' }).replace(lineBreak, '');
+  return fs.readFileSync(filename, { encoding: 'utf-8' }).replace(lineBreakRegExp, '');
 };
 
 var deleteFile = function(filename) {
@@ -143,7 +143,7 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({
   }),
   'from source': binaryContext('./test/data/reset.css', {
     'should minimize': function(error, stdout) {
-      var minimized = fs.readFileSync('./test/data/reset-min.css', 'utf-8').replace(lineBreak, '');
+      var minimized = fs.readFileSync('./test/data/reset-min.css', 'utf-8').replace(lineBreakRegExp, '');
       assert.equal(stdout, minimized);
     }
   }),
index 636a91f..a2b17ff 100644 (file)
@@ -5,7 +5,7 @@ var assert = require('assert');
 var path = require('path');
 var CleanCSS = require('../index');
 
-var lineBreak = process.platform == 'win32' ? '\r\n' : '\n';
+var lineBreak = require('os').EOL;
 var cssContext = function(groups, options) {
   var context = {};