|
| 1 | +/*jslint node:true, es5:true, unparam:true, nomen: true*/ |
| 2 | + |
| 3 | +'use strict'; |
| 4 | + |
| 5 | +var vows = require('vows'); |
| 6 | + |
| 7 | +var assert = require('assert'); |
| 8 | + |
| 9 | +var path = require('path'); |
| 10 | + |
| 11 | +var execFile = require('child_process').execFile; |
| 12 | + |
| 13 | +var suite = vows.describe('cli'); |
| 14 | + |
| 15 | +suite.addBatch({ |
| 16 | + 'defaults': { |
| 17 | + topic: function () { |
| 18 | + execFile(path.join(__dirname, '..', 'bin', 'cpplint'), [ |
| 19 | + path.join(__dirname, 'fixtures', 'node-cpp-hello.cpp') |
| 20 | + ], null, this.callback); |
| 21 | + }, |
| 22 | + |
| 23 | + 'should run successfully': function (err, stdout, stderr) { |
| 24 | + assert.isNull(err); |
| 25 | + assert.isString(stdout); |
| 26 | + assert.isEmpty(stderr); |
| 27 | + }, |
| 28 | + |
| 29 | + 'default verbosity is 1': function (err, stdout, stderr) { |
| 30 | + var lines = stdout.split('\n'); |
| 31 | + assert.lengthOf(lines, 7); |
| 32 | + }, |
| 33 | + |
| 34 | + 'default reporter is spec': function (err, stdout, stderr) { |
| 35 | + var lines = stdout.split('\n'); |
| 36 | + assert.match(lines[0], /✗/); |
| 37 | + assert.match(lines[0], /node\-cpp\-hello\.cpp/); |
| 38 | + }, |
| 39 | + |
| 40 | + 'default filters is no filters': function (err, stdout, stderr) { |
| 41 | + var lines = stdout.split('\n'); |
| 42 | + assert.lengthOf(lines, 7); |
| 43 | + }, |
| 44 | + |
| 45 | + 'default extensions is no extensions': function (err, stdout, stderr) { |
| 46 | + var lines = stdout.split('\n'); |
| 47 | + assert.lengthOf(lines, 7); |
| 48 | + } |
| 49 | + } |
| 50 | +}); |
| 51 | + |
| 52 | +suite.export(module); |
0 commit comments