mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
f29762f4dd
Enable linting for the test directory. A number of changes was made so all tests conform the current rules used by lib and src directories. The only exception for tests is that unreachable (dead) code is allowed. test-fs-non-number-arguments-throw had to be excluded from the changes because of a weird issue on Windows CI. PR-URL: https://github.com/nodejs/io.js/pull/1721 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
34 lines
882 B
JavaScript
34 lines
882 B
JavaScript
'use strict';
|
|
require('../common');
|
|
var assert = require('assert');
|
|
var exec = require('child_process').exec;
|
|
var os = require('os');
|
|
|
|
var success_count = 0;
|
|
|
|
var str = 'hello';
|
|
|
|
// default encoding
|
|
var child = exec('echo ' + str, function(err, stdout, stderr) {
|
|
assert.ok('string', typeof(stdout), 'Expected stdout to be a string');
|
|
assert.ok('string', typeof(stderr), 'Expected stderr to be a string');
|
|
assert.equal(str + os.EOL, stdout);
|
|
|
|
success_count++;
|
|
});
|
|
|
|
// no encoding (Buffers expected)
|
|
var child = exec('echo ' + str, {
|
|
encoding: null
|
|
}, function(err, stdout, stderr) {
|
|
assert.ok(stdout instanceof Buffer, 'Expected stdout to be a Buffer');
|
|
assert.ok(stderr instanceof Buffer, 'Expected stderr to be a Buffer');
|
|
assert.equal(str + os.EOL, stdout.toString());
|
|
|
|
success_count++;
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(2, success_count);
|
|
});
|