mirror of
https://github.com/nodejs/node.git
synced 2024-11-28 22:46:31 +01:00
0df54303c1
This commit changes many test styles to change all references from require('./common.js'); to require('./common');. The latter is much more common, with the former only being used in 50 tests. It is just a stylistic change, and it seems that `common.js` was introduced by a rogue test and copied and pasted into the rest. Semver: patch PR-URL: https://github.com/iojs/io.js/pull/917 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
41 lines
884 B
JavaScript
41 lines
884 B
JavaScript
var assert = require('assert');
|
|
var common = require('../common');
|
|
var http = require('http');
|
|
|
|
var start;
|
|
var server = http.createServer(function(req, res) {
|
|
req.resume();
|
|
req.on('end', function() {
|
|
res.end('Success');
|
|
});
|
|
|
|
server.close();
|
|
});
|
|
|
|
server.listen(common.PORT, 'localhost', function() {
|
|
var interval_id = setInterval(function() {
|
|
start = new Date();
|
|
if (start.getMilliseconds() > 100)
|
|
return;
|
|
|
|
console.log(start.toISOString());
|
|
var req = http.request({
|
|
'host': 'localhost',
|
|
'port': common.PORT,
|
|
'agent': false,
|
|
'method': 'PUT'
|
|
});
|
|
|
|
req.end('Test');
|
|
clearInterval(interval_id);
|
|
}, 10);
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
var end = new Date();
|
|
console.log(end.toISOString());
|
|
assert.equal(start.getSeconds(), end.getSeconds());
|
|
assert(end.getMilliseconds() < 900);
|
|
console.log('ok');
|
|
});
|