Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed tests to use normalized line endings. Closes GH-19.

  • Loading branch information...
commit aa6f423e64492e6a43e8f8e5bdb55cdf5c7644f5 1 parent 27c2ee3
@stevenbenner stevenbenner authored shama committed
Showing with 20 additions and 16 deletions.
  1. +20 −16 test/concat_test.js
View
36 test/concat_test.js
@@ -3,12 +3,16 @@
var grunt = require('grunt');
var comment = require('../tasks/lib/comment').init(grunt);
+function getNormalizedFile(filepath) {
+ return grunt.util.normalizelf(grunt.file.read(filepath));
+}
+
exports.concat = {
default_options: function(test) {
test.expect(1);
- var actual = grunt.file.read('tmp/default_options');
- var expected = grunt.file.read('test/expected/default_options');
+ var actual = getNormalizedFile('tmp/default_options');
+ var expected = getNormalizedFile('test/expected/default_options');
test.equal(actual, expected, 'should describe what the default behavior is.');
test.done();
@@ -16,8 +20,8 @@ exports.concat = {
custom_options: function(test) {
test.expect(1);
- var actual = grunt.file.read('tmp/custom_options');
- var expected = grunt.file.read('test/expected/custom_options');
+ var actual = getNormalizedFile('tmp/custom_options');
+ var expected = getNormalizedFile('test/expected/custom_options');
test.equal(actual, expected, 'should utilize custom banner, footer and separator.');
test.done();
@@ -25,8 +29,8 @@ exports.concat = {
handling_invalid_files: function(test) {
test.expect(1);
- var actual = grunt.file.read('tmp/handling_invalid_files');
- var expected = grunt.file.read('test/expected/handling_invalid_files');
+ var actual = getNormalizedFile('tmp/handling_invalid_files');
+ var expected = getNormalizedFile('test/expected/handling_invalid_files');
test.equal(actual, expected, 'will have warned, but should not fail.');
test.done();
@@ -34,18 +38,18 @@ exports.concat = {
strip_banner: function(test) {
test.expect(7);
- var src = grunt.file.read('test/fixtures/banner.js');
- test.equal(comment.stripBanner(src), '// Comment\n\n/* Comment */\n', 'It should strip the top banner.');
- test.equal(comment.stripBanner(src, {block: true}), '// Comment\n\n/* Comment */\n', 'It should strip the top banner.');
+ var src = getNormalizedFile('test/fixtures/banner.js');
+ test.equal(comment.stripBanner(src), grunt.util.normalizelf('// Comment\n\n/* Comment */\n'), 'It should strip the top banner.');
+ test.equal(comment.stripBanner(src, {block: true}), grunt.util.normalizelf('// Comment\n\n/* Comment */\n'), 'It should strip the top banner.');
- src = grunt.file.read('test/fixtures/banner2.js');
- test.equal(comment.stripBanner(src), '\n/*! SAMPLE\n * BANNER */\n\n// Comment\n\n/* Comment */\n', 'It should not strip the top banner.');
- test.equal(comment.stripBanner(src, {block: true}), '// Comment\n\n/* Comment */\n', 'It should strip the top banner.');
+ src = getNormalizedFile('test/fixtures/banner2.js');
+ test.equal(comment.stripBanner(src), grunt.util.normalizelf('\n/*! SAMPLE\n * BANNER */\n\n// Comment\n\n/* Comment */\n'), 'It should not strip the top banner.');
+ test.equal(comment.stripBanner(src, {block: true}), grunt.util.normalizelf('// Comment\n\n/* Comment */\n'), 'It should strip the top banner.');
- src = grunt.file.read('test/fixtures/banner3.js');
- test.equal(comment.stripBanner(src), '\n// This is\n// A sample\n// Banner\n\n// But this is not\n\n/* And neither\n * is this\n */\n', 'It should not strip the top banner.');
- test.equal(comment.stripBanner(src, {block: true}), '\n// This is\n// A sample\n// Banner\n\n// But this is not\n\n/* And neither\n * is this\n */\n', 'It should not strip the top banner.');
- test.equal(comment.stripBanner(src, {line: true}), '// But this is not\n\n/* And neither\n * is this\n */\n', 'It should strip the top banner.');
+ src = getNormalizedFile('test/fixtures/banner3.js');
+ test.equal(comment.stripBanner(src), grunt.util.normalizelf('\n// This is\n// A sample\n// Banner\n\n// But this is not\n\n/* And neither\n * is this\n */\n'), 'It should not strip the top banner.');
+ test.equal(comment.stripBanner(src, {block: true}), grunt.util.normalizelf('\n// This is\n// A sample\n// Banner\n\n// But this is not\n\n/* And neither\n * is this\n */\n'), 'It should not strip the top banner.');
+ test.equal(comment.stripBanner(src, {line: true}), grunt.util.normalizelf('// But this is not\n\n/* And neither\n * is this\n */\n'), 'It should strip the top banner.');
test.done();
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.