Skip to content

Commit 463aa19

Browse files
Trottr-52
authored andcommitted
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 754bcff commit 463aa19

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

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

Lines changed: 8 additions & 18 deletions
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-
varexpected_bad_requests=0;
14-
varactual_bad_requests=0;
15-
1613
varhost='********';
1714
host+=host;
1815
host+=host;
@@ -25,23 +22,20 @@ function do_not_call(){
2522
}
2623

2724
functiontest(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-
varreq=mod.get({host: host,port: 42},do_not_call);
33-
req.on('error',function(err){
28+
varreq1=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-
varreq=mod.request({method: 'GET',host: host,port: 42},do_not_call);
40-
req.on('error',function(err){
34+
varreq2=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‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ function runAb(opts, callback){
3737
varm=/DocumentLength:\s*(\d+)bytes/mi.exec(stdout);
3838
vardocumentLength=parseInt(m[1]);
3939

40-
varm=/Completerequests:\s*(\d+)/mi.exec(stdout);
40+
m=/Completerequests:\s*(\d+)/mi.exec(stdout);
4141
varcompleteRequests=parseInt(m[1]);
4242

43-
varm=/HTMLtransferred:\s*(\d+)bytes/mi.exec(stdout);
43+
m=/HTMLtransferred:\s*(\d+)bytes/mi.exec(stdout);
4444
varhtmlTransfered=parseInt(m[1]);
4545

4646
assert.equal(bodyLength,documentLength);

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

Lines changed: 1 addition & 1 deletion
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-
varheaders=headers||parser.headers;
263+
headers=headers||parser.headers;
264264

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

0 commit comments

Comments
(0)