Depreciate onLoad
This commit is contained in:
parent
79f121044c
commit
31265be4a6
@ -126,7 +126,13 @@ node.Module.prototype.load = function (callback) {
|
||||
self.onExit = self.target.__onExit;
|
||||
|
||||
self.waitChildrenLoad(function () {
|
||||
if (self.onLoad) self.onLoad();
|
||||
if (self.onLoad) {
|
||||
node.stdio.writeError( "(node) onLoad is depreciated it will be "
|
||||
+ "removed in the future. Don't want it to "
|
||||
+ "leave? Discuss on mailing list.\n"
|
||||
);
|
||||
self.onLoad();
|
||||
}
|
||||
self.loaded = true;
|
||||
loadPromise.emitSuccess([self.target]);
|
||||
});
|
||||
|
@ -1,6 +1,5 @@
|
||||
include("mjsunit.js");
|
||||
|
||||
function onLoad () {
|
||||
var a = [116,101,115,116,32,206,163,207,131,207,128,206,177,32,226,161,140,226,160, 129,226,160,167,226,160,145];
|
||||
var s = node.encodeUtf8(a);
|
||||
assertEquals("test Σσπα ⡌⠁⠧⠑", s);
|
||||
@ -8,4 +7,3 @@ function onLoad () {
|
||||
a = [104, 101, 108, 108, 111];
|
||||
s = node.encodeUtf8(a);
|
||||
assertEquals("hello", s);
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ var e = new node.EventEmitter();
|
||||
var events_new_listener_emited = [];
|
||||
var times_hello_emited = 0;
|
||||
|
||||
function onLoad () {
|
||||
e.addListener("newListener", function (event, listener) {
|
||||
puts("newListener: " + event);
|
||||
events_new_listener_emited.push(event);
|
||||
@ -21,7 +20,6 @@ function onLoad () {
|
||||
puts("start");
|
||||
|
||||
e.emit("hello", ["a", "b"]);
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertArrayEquals(["hello"], events_new_listener_emited);
|
||||
|
@ -1,7 +1,6 @@
|
||||
include("mjsunit.js");
|
||||
var got_error = false;
|
||||
|
||||
function onLoad () {
|
||||
var dirname = node.path.dirname(__filename);
|
||||
var fixtures = node.path.join(dirname, "fixtures");
|
||||
var filename = node.path.join(fixtures, "does_not_exist.txt");
|
||||
@ -16,7 +15,6 @@ function onLoad () {
|
||||
promise.addErrback(function () {
|
||||
got_error = true;
|
||||
});
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertTrue(got_error);
|
||||
|
@ -16,7 +16,6 @@ server.listen(PORT);
|
||||
var got_good_server_content = false;
|
||||
var bad_server_got_error = false;
|
||||
|
||||
function onLoad () {
|
||||
node.http.cat("http://localhost:"+PORT+"/", "utf8").addCallback(function (content) {
|
||||
puts("got response");
|
||||
got_good_server_content = true;
|
||||
@ -28,7 +27,6 @@ function onLoad () {
|
||||
puts("got error (this should happen)");
|
||||
bad_server_got_error = true;
|
||||
});
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertTrue(got_good_server_content);
|
||||
|
@ -24,7 +24,6 @@ var server = node.http.createServer(function(req, res) {
|
||||
});
|
||||
server.listen(PORT);
|
||||
|
||||
function onLoad () {
|
||||
var client = node.http.createClient(PORT);
|
||||
var req = client.post('/');
|
||||
|
||||
@ -43,7 +42,6 @@ function onLoad () {
|
||||
server.close();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertEquals("1\n2\n3\n", sent_body);
|
||||
|
@ -32,7 +32,6 @@ proxy.listen(PROXY_PORT);
|
||||
|
||||
var body = "";
|
||||
|
||||
function onLoad () {
|
||||
var client = node.http.createClient(PROXY_PORT);
|
||||
var req = client.get("/test");
|
||||
// node.debug("client req")
|
||||
@ -47,7 +46,6 @@ function onLoad () {
|
||||
// node.debug("closed both");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertEquals(body, "hello world\n");
|
||||
|
@ -7,8 +7,6 @@ var requests_sent = 0;
|
||||
var server_response = "";
|
||||
var client_got_eof = false;
|
||||
|
||||
function onLoad() {
|
||||
|
||||
node.http.createServer(function (req, res) {
|
||||
res.id = request_number;
|
||||
req.id = request_number++;
|
||||
@ -60,7 +58,6 @@ function onLoad() {
|
||||
c.addListener("close", function () {
|
||||
assertEquals(c.readyState, "closed");
|
||||
});
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertEquals(2, request_number);
|
||||
|
@ -6,7 +6,6 @@ var responses_recvd = 0;
|
||||
var body0 = "";
|
||||
var body1 = "";
|
||||
|
||||
function onLoad () {
|
||||
node.http.createServer(function (req, res) {
|
||||
if (responses_sent == 0) {
|
||||
assertEquals("GET", req.method);
|
||||
@ -56,7 +55,6 @@ function onLoad () {
|
||||
node.debug("Got /world response");
|
||||
});
|
||||
}, 1);
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
node.debug("responses_recvd: " + responses_recvd);
|
||||
|
@ -3,7 +3,6 @@ var a = require("fixtures/a.js");
|
||||
var d = require("fixtures/b/d.js");
|
||||
var d2 = require("fixtures/b/d.js");
|
||||
|
||||
function onLoad () {
|
||||
assertFalse(false, "testing the test program.");
|
||||
|
||||
assertInstanceof(a.A, Function);
|
||||
@ -20,7 +19,6 @@ function onLoad () {
|
||||
|
||||
assertInstanceof(d2.D, Function);
|
||||
assertEquals("D", d2.D());
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertInstanceof(a.A, Function);
|
||||
|
@ -18,7 +18,6 @@ server.listen(PORT);
|
||||
var errors = 0;
|
||||
var successes = 0;
|
||||
|
||||
function onLoad () {
|
||||
var promise = node.cat("http://localhost:"+PORT, "utf8");
|
||||
|
||||
promise.addCallback(function (content) {
|
||||
@ -45,7 +44,6 @@ function onLoad () {
|
||||
promise.addErrback(function () {
|
||||
errors += 1;
|
||||
});
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertEquals(2, successes);
|
||||
|
@ -18,13 +18,11 @@ function pwd (callback) {
|
||||
}
|
||||
|
||||
|
||||
function onLoad () {
|
||||
pwd(function (result) {
|
||||
p(result);
|
||||
assertTrue(result.length > 1);
|
||||
assertEquals("\n", result[result.length-1]);
|
||||
});
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertTrue(pwd_called);
|
||||
|
@ -2,7 +2,6 @@ include("mjsunit.js");
|
||||
|
||||
var exit_status = -1;
|
||||
|
||||
function onLoad () {
|
||||
var cat = node.createProcess("cat");
|
||||
|
||||
cat.addListener("output", function (chunk) { assertEquals(null, chunk); });
|
||||
@ -10,7 +9,6 @@ function onLoad () {
|
||||
cat.addListener("exit", function (status) { exit_status = status; });
|
||||
|
||||
cat.kill();
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertTrue(exit_status > 0);
|
||||
|
@ -24,11 +24,9 @@ cat.addListener("exit", function (status) {
|
||||
exit_status = status;
|
||||
});
|
||||
|
||||
function onLoad () {
|
||||
cat.write("hello");
|
||||
cat.write(" ");
|
||||
cat.write("world");
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertEquals(0, exit_status);
|
||||
|
@ -20,9 +20,7 @@ function spawn (i) {
|
||||
});
|
||||
}
|
||||
|
||||
function onLoad () {
|
||||
spawn(0);
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertTrue(finished);
|
||||
|
@ -44,7 +44,6 @@ p5.addCallback(function () {
|
||||
}, 100);
|
||||
});
|
||||
|
||||
function onLoad () {
|
||||
|
||||
p2.emitSuccess();
|
||||
|
||||
@ -73,7 +72,6 @@ function onLoad () {
|
||||
assertArrayEquals(["a","b","c"], ret4);
|
||||
|
||||
assertTrue(p4_done);
|
||||
}
|
||||
|
||||
function onExit() {
|
||||
assertTrue(p1_done);
|
||||
|
@ -12,8 +12,6 @@ s.listen(8000);
|
||||
include("mjsunit.js");
|
||||
var a = require("http://localhost:8000/")
|
||||
|
||||
function onLoad() {
|
||||
assertInstanceof(a.A, Function);
|
||||
assertEquals("A", a.A());
|
||||
s.close();
|
||||
}
|
||||
|
@ -55,14 +55,12 @@ function runClient (callback) {
|
||||
}
|
||||
|
||||
|
||||
function onLoad () {
|
||||
var finished_clients = 0;
|
||||
for (var i = 0; i < concurrency; i++) {
|
||||
runClient(function () {
|
||||
if (++finished_clients == concurrency) server.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertEquals(connections_per_client * concurrency, total_connections);
|
||||
|
@ -83,9 +83,7 @@ function pingPongTest (port, host, on_complete) {
|
||||
});
|
||||
}
|
||||
|
||||
function onLoad () {
|
||||
pingPongTest(21988);
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertEquals(1, tests_run);
|
||||
|
@ -77,12 +77,10 @@ function pingPongTest (port, host, on_complete) {
|
||||
});
|
||||
}
|
||||
|
||||
function onLoad () {
|
||||
/* All are run at once, so run on different ports */
|
||||
pingPongTest(20989, "localhost");
|
||||
pingPongTest(20988, null);
|
||||
pingPongTest(20997, "::1");
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertEquals(3, tests_run);
|
||||
|
@ -14,7 +14,6 @@ echoServer.listen(PORT);
|
||||
var recv = [];
|
||||
var j = 0;
|
||||
|
||||
function onLoad () {
|
||||
var c = node.tcp.createConnection(PORT);
|
||||
|
||||
c.addListener("receive", function (chunk) {
|
||||
@ -36,7 +35,6 @@ function onLoad () {
|
||||
p(recv);
|
||||
echoServer.close();
|
||||
});
|
||||
};
|
||||
|
||||
function onExit () {
|
||||
var expected = [];
|
||||
|
@ -6,8 +6,6 @@ var c = 0;
|
||||
var client_recv_count = 0;
|
||||
var disconnect_count = 0;
|
||||
|
||||
function onLoad () {
|
||||
|
||||
var server = node.tcp.createServer(function (socket) {
|
||||
socket.addListener("connect", function () {
|
||||
socket.send("hello\r\n");
|
||||
@ -47,7 +45,6 @@ function onLoad () {
|
||||
else
|
||||
server.close();
|
||||
});
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertEquals(N+1, disconnect_count);
|
||||
|
@ -23,7 +23,6 @@ chars_recved = 0;
|
||||
npauses = 0;
|
||||
|
||||
|
||||
function onLoad () {
|
||||
var paused = false;
|
||||
client = node.tcp.createConnection(PORT);
|
||||
client.setEncoding("ascii");
|
||||
@ -49,7 +48,6 @@ function onLoad () {
|
||||
server.close();
|
||||
client.close();
|
||||
});
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertEquals(N, chars_recved);
|
||||
|
@ -21,7 +21,6 @@ server.listen(PORT);
|
||||
recv = "";
|
||||
chars_recved = 0;
|
||||
|
||||
function onLoad () {
|
||||
client = node.tcp.createConnection(PORT);
|
||||
client.setEncoding("ascii");
|
||||
client.addListener("receive", function (d) {
|
||||
@ -61,7 +60,6 @@ function onLoad () {
|
||||
server.close();
|
||||
client.close();
|
||||
});
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertEquals(N, recv.length);
|
||||
|
@ -5,7 +5,6 @@ var WINDOW = 800; // why is does this need to be so big?
|
||||
var interval_count = 0;
|
||||
var setTimeout_called = false;
|
||||
|
||||
function onLoad () {
|
||||
assertInstanceof(setTimeout, Function);
|
||||
var starttime = new Date;
|
||||
|
||||
@ -35,7 +34,6 @@ function onLoad () {
|
||||
if (interval_count == 3)
|
||||
clearInterval(this);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function onExit () {
|
||||
assertTrue(setTimeout_called);
|
||||
|
@ -4,7 +4,5 @@ include("mjsunit.js");
|
||||
|
||||
puts("Σὲ γνωρίζω ἀπὸ τὴν κόψη");
|
||||
|
||||
function onLoad () {
|
||||
assertTrue( /Hellö Wörld/.test("Hellö Wörld") );
|
||||
}
|
||||
assertTrue( /Hellö Wörld/.test("Hellö Wörld") );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user