node/test/mjsunit/test-remote-module-loading.js

20 lines
430 B
JavaScript
Raw Normal View History

2009-06-21 22:59:11 +08:00
var s = new node.http.Server(function (req, res) {
2009-06-16 14:20:00 +08:00
var body = "exports.A = function() { return 'A';}";
res.sendHeader(200, [
["Content-Length", body.length],
["Content-Type", "text/plain"]
]);
res.sendBody(body);
res.finish();
2009-06-21 22:59:11 +08:00
});
s.listen(8000);
2009-06-16 14:20:00 +08:00
include("mjsunit.js");
var a = require("http://localhost:8000/")
function onLoad() {
assertInstanceof(a.A, Function);
assertEquals("A", a.A());
2009-06-21 22:59:11 +08:00
s.close();
2009-06-17 14:52:47 +08:00
}