Skip to content

Commit 9dd5b3e

Browse files
Trottrvagg
authored andcommittedFeb 8, 2016
test: fix redeclared test-http-* vars
PR-URL: #4987 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Roman Klauke <[email protected]>
1 parent 835bf13 commit 9dd5b3e

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed
 

‎test/parallel/test-http-dns-error.js

+8-18
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ if (common.hasCrypto) {
1010
console.log('1..0 # Skipped: missing crypto');
1111
}
1212

13-
var expected_bad_requests = 0;
14-
var actual_bad_requests = 0;
15-
1613
var host = '********';
1714
host += host;
1815
host += host;
@@ -25,23 +22,20 @@ function do_not_call() {
2522
}
2623

2724
function test(mod) {
28-
expected_bad_requests += 2;
2925

3026
// Bad host name should not throw an uncatchable exception.
3127
// Ensure that there is time to attach an error listener.
32-
var req = mod.get({host: host, port: 42}, do_not_call);
33-
req.on('error', function(err) {
28+
var req1 = mod.get({host: host, port: 42}, do_not_call);
29+
req1.on('error', common.mustCall(function(err) {
3430
assert.equal(err.code, 'ENOTFOUND');
35-
actual_bad_requests++;
36-
});
37-
// http.get() called req.end() for us
31+
}));
32+
// http.get() called req1.end() for us
3833

39-
var req = mod.request({method: 'GET', host: host, port: 42}, do_not_call);
40-
req.on('error', function(err) {
34+
var req2 = mod.request({method: 'GET', host: host, port: 42}, do_not_call);
35+
req2.on('error', common.mustCall(function(err) {
4136
assert.equal(err.code, 'ENOTFOUND');
42-
actual_bad_requests++;
43-
});
44-
req.end();
37+
}));
38+
req2.end();
4539
}
4640

4741
if (common.hasCrypto) {
@@ -51,7 +45,3 @@ if (common.hasCrypto) {
5145
}
5246

5347
test(http);
54-
55-
process.on('exit', function() {
56-
assert.equal(actual_bad_requests, expected_bad_requests);
57-
});

‎test/parallel/test-http-full-response.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ function runAb(opts, callback) {
3737
var m = /Document Length:\s*(\d+) bytes/mi.exec(stdout);
3838
var documentLength = parseInt(m[1]);
3939

40-
var m = /Complete requests:\s*(\d+)/mi.exec(stdout);
40+
m = /Complete requests:\s*(\d+)/mi.exec(stdout);
4141
var completeRequests = parseInt(m[1]);
4242

43-
var m = /HTML transferred:\s*(\d+) bytes/mi.exec(stdout);
43+
m = /HTML transferred:\s*(\d+) bytes/mi.exec(stdout);
4444
var htmlTransfered = parseInt(m[1]);
4545

4646
assert.equal(bodyLength, documentLength);

‎test/parallel/test-http-parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ function expectBody(expected) {
260260
assert.equal(versionMajor, 1);
261261
assert.equal(versionMinor, 0);
262262

263-
var headers = headers || parser.headers;
263+
headers = headers || parser.headers;
264264

265265
assert.equal(headers.length, 2 * 256); // 256 key/value pairs
266266
for (var i = 0; i < headers.length; i += 2) {

0 commit comments

Comments
 (0)
Please sign in to comment.