source: Dev/trunk/node_modules/grunt-exec/test/test.js @ 484

Last change on this file since 484 was 484, checked in by hendrikvanantwerpen, 11 years ago

Commit node_modules, to make checkouts and builds more deterministic.

File size: 1.0 KB
Line 
1var grunt = require('grunt')
2  , path = require('path')
3  , fs = require('fs')
4  , assert = require('assert')
5  , testDir = path.join(process.cwd(), 'test')
6  , opts = { gruntfile: path.join(testDir, 'Gruntfile.js') }
7  , tasks = ['exec:test1', 'exec:test2', 'exec:test3:42:love', 'exec:test4'];
8
9grunt.tasks(tasks, opts, function() {
10  var tests = [
11        { name: 'test1', expected: 'bruce willis was dead\n' }
12      , { name: 'test2' , expected: 'grunt@' + grunt.version + '\n' }
13      , {
14          name: 'test3'
15        , expected: [
16            'the answer to life is 42', 'thoughts on tacos? love', ''
17          ].join('\n')
18        }
19      , {
20          name: 'test4'
21        , expected:'you can use callback, and error, stdout, stderr can be used as arguments\n'
22        }
23      ]
24    , outputPath;
25
26  tests.forEach(function(test) {
27    outputPath = path.join(testDir, test.name);
28    assert.equal(fs.readFileSync(outputPath, 'utf8'), test.expected);
29
30    // clean up
31    fs.unlinkSync(outputPath);
32
33    grunt.log.ok(test.name +' passed');
34  });
35});
Note: See TracBrowser for help on using the repository browser.