mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 18:17:17 +00:00

Enable `space-unary-ops` in `.eslintrc`. This prohibits things like: i ++ // use `i++` instead typeof(foo) // use `typeof foo` or `typeof (foo)` instead Ref: https://github.com/nodejs/node/pull/4772#discussion_r51732299 PR-URL: https://github.com/nodejs/node/pull/5063 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: James M Snell <jasnell@gmail.com>
34 lines
856 B
JavaScript
34 lines
856 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
|
|
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)
|
|
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);
|
|
});
|