2009-06-26 18:51:27 +08:00
|
|
|
var s = node.http.createServer(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
|
|
|
}
|