mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
941 B
38 lines
941 B
15 years ago
|
require("../common");
|
||
15 years ago
|
|
||
|
var http = require('http');
|
||
|
var sys = require('sys');
|
||
15 years ago
|
var url = require("url");
|
||
15 years ago
|
var modulesLoaded = 0;
|
||
|
|
||
|
var server = http.createServer(function(req, res) {
|
||
|
var body = 'exports.httpPath = function() {'+
|
||
15 years ago
|
'return '+JSON.stringify(url.parse(req.url).pathname)+';'+
|
||
15 years ago
|
'};';
|
||
|
|
||
15 years ago
|
res.writeHead(200, {'Content-Type': 'text/javascript'});
|
||
15 years ago
|
res.write(body);
|
||
15 years ago
|
res.end();
|
||
15 years ago
|
});
|
||
|
server.listen(PORT);
|
||
|
|
||
15 years ago
|
assert.throws(function () {
|
||
|
var httpModule = require('http://localhost:'+PORT+'/moduleA.js');
|
||
|
assert.equal('/moduleA.js', httpModule.httpPath());
|
||
|
modulesLoaded++;
|
||
|
});
|
||
15 years ago
|
|
||
|
var nodeBinary = process.ARGV[0];
|
||
15 years ago
|
var cmd = 'NODE_PATH='+libDir+' '+nodeBinary+' http://localhost:'+PORT+'/moduleB.js';
|
||
15 years ago
|
|
||
15 years ago
|
sys.exec(cmd, function (err, stdout, stderr) {
|
||
|
if (err) throw err;
|
||
|
puts('success!');
|
||
|
modulesLoaded++;
|
||
|
server.close();
|
||
|
});
|
||
15 years ago
|
|
||
|
process.addListener('exit', function() {
|
||
15 years ago
|
assert.equal(1, modulesLoaded);
|
||
15 years ago
|
});
|