Skip to content

Commit

Permalink
Add test case for exclude sub. Relates to gruntjs#65.
Browse files Browse the repository at this point in the history
  • Loading branch information
adjohnson916 committed Jul 5, 2015
1 parent 381f370 commit d642845
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
14 changes: 11 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ module.exports = function(grunt) {
longPathTest: {
src: ['tmp/sample_long']
},
exclude: ['tmp/end_01/**/*', '!tmp/end_01/1.txt']
exclude: ['tmp/end_01/**/*', '!tmp/end_01/1.txt'],
excludeSub: ['tmp/end_02/**/*.*', '!tmp/end_02/2/**/*']
},

// Unit tests.
Expand All @@ -50,12 +51,19 @@ module.exports = function(grunt) {
grunt.registerTask('copy', 'Copy fixtures to a temp location.', function() {
grunt.file.copy('test/fixtures/sample_long/long.txt', 'tmp/sample_long/long.txt');
grunt.file.copy('test/fixtures/sample_short/short.txt', 'tmp/sample_short/short.txt');

var cwd = 'test/fixtures/start';
grunt.file.expand({
cwd: cwd
}, '**/*')
}, '**/*.*')
.forEach(function (file) {
grunt.file.copy(cwd + '/' + file, 'tmp/end_01/' + file);
var ecwd = 'test/expected';
grunt.file.expand({
cwd: ecwd
}, '*')
.forEach(function (dir) {
grunt.file.copy(cwd + '/' + file, 'tmp/' + dir + '/' + file);
});
});
});

Expand Down
7 changes: 6 additions & 1 deletion test/clean_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ exports.clean = {
},
exclude: function (test) {
var res = dircompare.compareSync('test/expected/end_01', 'tmp/end_01');
test.equal(true, res.equal, 'should match exclusions');
test.equal(true, res.same, 'should match exclusions');
test.done();
},
excludeSub: function (test) {
var res = dircompare.compareSync('test/expected/end_02', 'tmp/end_02');
test.equal(true, res.same, 'should match exclusions for sub');
test.done();
}
};
Empty file added test/expected/end_02/2/1.txt
Empty file.
Empty file added test/fixtures/start/2/1.txt
Empty file.

0 comments on commit d642845

Please sign in to comment.