Browse Source

tests: fix more lint issues

v0.7.4-release
Bert Belder 13 years ago
parent
commit
892056bf97
  1. 15
      test/simple/test-child-process-double-pipe.js
  2. 4
      test/simple/test-executable-path.js
  3. 6
      test/simple/test-http-1.0.js
  4. 4
      test/simple/test-path-makelong.js
  5. 61
      test/simple/test-repl-tab-complete.js
  6. 6
      test/simple/test-script-context.js
  7. 2
      test/simple/test-stdin-child-proc.js

15
test/simple/test-child-process-double-pipe.js

@ -28,11 +28,16 @@ var assert = require('assert'),
// We're trying to reproduce: // We're trying to reproduce:
// $ echo "hello\nnode\nand\nworld" | grep o | sed s/o/a/ // $ echo "hello\nnode\nand\nworld" | grep o | sed s/o/a/
var echo = is_windows ? spawn('cmd.exe', ['/c', 'echo', 'hello&&', 'echo', var grep = spawn('grep', ['o']),
'node&&', 'echo', 'and&&', 'echo', 'world']) : sed = spawn('sed', ['s/o/O/']),
spawn('echo', ['hello\nnode\nand\nworld\n']), echo;
grep = spawn('grep', ['o']),
sed = spawn('sed', ['s/o/O/']); if (is_windows) {
echo = spawn('cmd.exe', ['/c', 'echo', 'hello&&', 'echo',
'node&&', 'echo', 'and&&', 'echo', 'world']);
} else {
echo = spawn('echo', ['hello\nnode\nand\nworld\n']);
}
/* /*
* grep and sed hang if the spawn function leaks file descriptors to child * grep and sed hang if the spawn function leaks file descriptors to child

4
test/simple/test-executable-path.js

@ -26,11 +26,11 @@ var match = false;
var isDebug = process.features.debug; var isDebug = process.features.debug;
var debugPaths = [ path.normalize(path.join(__dirname, '..', '..', var debugPaths = [path.normalize(path.join(__dirname, '..', '..',
'out', 'Debug', 'node')), 'out', 'Debug', 'node')),
path.normalize(path.join(__dirname, '..', '..', path.normalize(path.join(__dirname, '..', '..',
'Debug', 'node'))]; 'Debug', 'node'))];
var defaultPaths = [ path.normalize(path.join(__dirname, '..', '..', var defaultPaths = [path.normalize(path.join(__dirname, '..', '..',
'out', 'Release', 'node')), 'out', 'Release', 'node')),
path.normalize(path.join(__dirname, '..', '..', path.normalize(path.join(__dirname, '..', '..',
'Release', 'node'))]; 'Release', 'node'))];

6
test/simple/test-http-1.0.js

@ -112,7 +112,8 @@ function test(handler, request_generator, response_validator) {
function request_generator() { function request_generator() {
return ('GET / HTTP/1.0\r\n' + return ('GET / HTTP/1.0\r\n' +
'User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15\r\n' + 'User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 ' +
'OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15\r\n' +
'Host: 127.0.0.1:1337\r\n' + 'Host: 127.0.0.1:1337\r\n' +
'Accept: */*\r\n' + 'Accept: */*\r\n' +
'\r\n'); '\r\n');
@ -147,7 +148,8 @@ function test(handler, request_generator, response_validator) {
function request_generator() { function request_generator() {
return ('GET / HTTP/1.1\r\n' + return ('GET / HTTP/1.1\r\n' +
'User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15\r\n' + 'User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 ' +
'OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15\r\n' +
'Connection: close\r\n' + 'Connection: close\r\n' +
'Host: 127.0.0.1:1337\r\n' + 'Host: 127.0.0.1:1337\r\n' +
'Accept: */*\r\n' + 'Accept: */*\r\n' +

4
test/simple/test-path-makelong.js

@ -26,7 +26,6 @@ if (process.platform === 'win32') {
var file = path.join(common.fixturesDir, 'a.js'); var file = path.join(common.fixturesDir, 'a.js');
var resolvedFile = path.resolve(file); var resolvedFile = path.resolve(file);
var networkFile = '\\\\someserver\\someshare\\somefile';
assert.equal('\\\\?\\' + resolvedFile, path._makeLong(file)); assert.equal('\\\\?\\' + resolvedFile, path._makeLong(file));
assert.equal('\\\\?\\' + resolvedFile, path._makeLong('\\\\?\\' + file)); assert.equal('\\\\?\\' + resolvedFile, path._makeLong('\\\\?\\' + file));
@ -34,5 +33,6 @@ if (process.platform === 'win32') {
path._makeLong('\\\\someserver\\someshare\\somefile')); path._makeLong('\\\\someserver\\someshare\\somefile'));
assert.equal('\\\\?\\UNC\\someserver\\someshare\\somefile', assert.equal('\\\\?\\UNC\\someserver\\someshare\\somefile',
path._makeLong('\\\\?\\UNC\\someserver\\someshare\\somefile')); path._makeLong('\\\\?\\UNC\\someserver\\someshare\\somefile'));
assert.equal('\\\\.\\pipe\\somepipe', path._makeLong('\\\\.\\pipe\\somepipe')); assert.equal('\\\\.\\pipe\\somepipe',
path._makeLong('\\\\.\\pipe\\somepipe'));
} }

61
test/simple/test-repl-tab-complete.js

@ -26,9 +26,9 @@ var repl = require('repl');
// A stream to push an array into a REPL // A stream to push an array into a REPL
function ArrayStream() { function ArrayStream() {
this.run = function (data) { this.run = function(data) {
var self = this; var self = this;
data.forEach(function (line) { data.forEach(function(line) {
self.emit('data', line); self.emit('data', line);
}); });
} }
@ -36,11 +36,11 @@ function ArrayStream() {
util.inherits(ArrayStream, require('stream').Stream); util.inherits(ArrayStream, require('stream').Stream);
ArrayStream.prototype.readable = true; ArrayStream.prototype.readable = true;
ArrayStream.prototype.writable = true; ArrayStream.prototype.writable = true;
ArrayStream.prototype.resume = function () {}; ArrayStream.prototype.resume = function() {};
ArrayStream.prototype.write = function () {}; ArrayStream.prototype.write = function() {};
var works = [ [ 'inner.one' ], 'inner.o' ]; var works = [['inner.one'], 'inner.o'];
var doesNotBreak = [ [], 'inner.o' ]; var doesNotBreak = [[], 'inner.o'];
var putIn = new ArrayStream(); var putIn = new ArrayStream();
var testMe = repl.start('', putIn); var testMe = repl.start('', putIn);
@ -49,14 +49,15 @@ var testMe = repl.start('', putIn);
putIn.run(['.clear']); putIn.run(['.clear']);
putIn.run([ putIn.run([
'var inner = {', 'var inner = {',
'one:1']); 'one:1'
testMe.complete('inner.o', function (error, data) { ]);
testMe.complete('inner.o', function(error, data) {
assert.deepEqual(data, doesNotBreak); assert.deepEqual(data, doesNotBreak);
}); });
// Tab Complete will return globaly scoped variables // Tab Complete will return globaly scoped variables
putIn.run(['};']); putIn.run(['};']);
testMe.complete('inner.o', function (error, data) { testMe.complete('inner.o', function(error, data) {
assert.deepEqual(data, works); assert.deepEqual(data, works);
}); });
@ -66,8 +67,9 @@ putIn.run(['.clear']);
putIn.run([ putIn.run([
'var inner = ( true ' , 'var inner = ( true ' ,
'?', '?',
'{one: 1} : ']); '{one: 1} : '
testMe.complete('inner.o', function (error, data) { ]);
testMe.complete('inner.o', function(error, data) {
assert.deepEqual(data, doesNotBreak); assert.deepEqual(data, doesNotBreak);
}); });
@ -76,15 +78,16 @@ putIn.run(['.clear']);
// Tab Complete will return a simple local variable // Tab Complete will return a simple local variable
putIn.run([ putIn.run([
'var top = function () {', 'var top = function () {',
'var inner = {one:1};']); 'var inner = {one:1};'
testMe.complete('inner.o', function (error, data) { ]);
testMe.complete('inner.o', function(error, data) {
assert.deepEqual(data, works); assert.deepEqual(data, works);
}); });
// When you close the function scope tab complete will not return the // When you close the function scope tab complete will not return the
// locally scoped variable // locally scoped variable
putIn.run(['};']); putIn.run(['};']);
testMe.complete('inner.o', function (error, data) { testMe.complete('inner.o', function(error, data) {
assert.deepEqual(data, doesNotBreak); assert.deepEqual(data, doesNotBreak);
}); });
@ -95,8 +98,9 @@ putIn.run([
'var top = function () {', 'var top = function () {',
'var inner = {', 'var inner = {',
' one:1', ' one:1',
'};']); '};'
testMe.complete('inner.o', function (error, data) { ]);
testMe.complete('inner.o', function(error, data) {
assert.deepEqual(data, works); assert.deepEqual(data, works);
}); });
@ -108,8 +112,9 @@ putIn.run([
'var top = function (one, two) {', 'var top = function (one, two) {',
'var inner = {', 'var inner = {',
' one:1', ' one:1',
'};']); '};'
testMe.complete('inner.o', function (error, data) { ]);
testMe.complete('inner.o', function(error, data) {
assert.deepEqual(data, works); assert.deepEqual(data, works);
}); });
@ -122,8 +127,9 @@ putIn.run([
'(function test () {', '(function test () {',
'var inner = {', 'var inner = {',
' one:1', ' one:1',
'};']); '};'
testMe.complete('inner.o', function (error, data) { ]);
testMe.complete('inner.o', function(error, data) {
assert.deepEqual(data, works); assert.deepEqual(data, works);
}); });
@ -137,8 +143,9 @@ putIn.run([
' one, two) {', ' one, two) {',
'var inner = {', 'var inner = {',
' one:1', ' one:1',
'};']); '};'
testMe.complete('inner.o', function (error, data) { ]);
testMe.complete('inner.o', function(error, data) {
assert.deepEqual(data, doesNotBreak); assert.deepEqual(data, doesNotBreak);
}); });
@ -151,8 +158,9 @@ putIn.run([
'{', '{',
'var inner = {', 'var inner = {',
' one:1', ' one:1',
'};']); '};'
testMe.complete('inner.o', function (error, data) { ]);
testMe.complete('inner.o', function(error, data) {
assert.deepEqual(data, doesNotBreak); assert.deepEqual(data, doesNotBreak);
}); });
@ -166,8 +174,9 @@ putIn.run([
'{', '{',
'var inner = {', 'var inner = {',
' one:1', ' one:1',
'};']); '};'
testMe.complete('inner.o', function (error, data) { ]);
testMe.complete('inner.o', function(error, data) {
assert.deepEqual(data, doesNotBreak); assert.deepEqual(data, doesNotBreak);
}); });

6
test/simple/test-script-context.js

@ -54,9 +54,11 @@ try {
} }
catch (e) { catch (e) {
gh1140Exception = e; gh1140Exception = e;
assert.ok(/expected-filename/.test(e.stack), 'expected appearance of filename in Error stack'); assert.ok(/expected-filename/.test(e.stack),
'expected appearance of filename in Error stack');
} }
assert.ok(gh1140Exception, 'expected exception from runInContext signature test'); assert.ok(gh1140Exception,
'expected exception from runInContext signature test');
// GH-558, non-context argument segfaults / raises assertion // GH-558, non-context argument segfaults / raises assertion
function isTypeError(o) { function isTypeError(o) {

2
test/simple/test-stdin-child-proc.js

@ -24,4 +24,4 @@
var child_process = require('child_process'); var child_process = require('child_process');
var path = require('path'); var path = require('path');
child_process.spawn(process.execPath, child_process.spawn(process.execPath,
[ path.resolve(__dirname, 'test-stdin-pause-resume.js') ]); [path.resolve(__dirname, 'test-stdin-pause-resume.js')]);

Loading…
Cancel
Save