1 | 'use strict';
|
2 |
|
3 | var grunt = require('../../lib/grunt');
|
4 |
|
5 | exports['option'] = {
|
6 | setUp: function(done) {
|
7 | grunt.option.init();
|
8 | done();
|
9 | },
|
10 | tearDown: function(done) {
|
11 | grunt.option.init();
|
12 | done();
|
13 | },
|
14 | 'option.init': function(test) {
|
15 | test.expect(1);
|
16 | var expected = {foo:'bar',bool:true,'bar':{foo:'bar'}};
|
17 | test.deepEqual(grunt.option.init(expected), expected);
|
18 | test.done();
|
19 | },
|
20 | 'option': function(test) {
|
21 | test.expect(4);
|
22 | test.equal(grunt.option('foo', 'bar'), grunt.option('foo'));
|
23 | grunt.option('foo', {foo:'bar'});
|
24 | test.deepEqual(grunt.option('foo'), {foo:'bar'});
|
25 | test.equal(grunt.option('no-there'), false);
|
26 | grunt.option('there', false);
|
27 | test.equal(grunt.option('no-there'), true);
|
28 | test.done();
|
29 | },
|
30 | 'option.flags': function(test) {
|
31 | test.expect(1);
|
32 | grunt.option.init({
|
33 | foo: 'bar',
|
34 | there: true,
|
35 | obj: {foo: 'bar'},
|
36 | arr: []
|
37 | });
|
38 | test.deepEqual(grunt.option.flags(), ['--foo=bar', '--there', '--obj=[object Object]']);
|
39 | test.done();
|
40 | },
|
41 | };
|