30 lines
1.2 KiB
Plaintext
30 lines
1.2 KiB
Plaintext
var time = use('time');
|
|
|
|
return {
|
|
test_overling: function() {
|
|
// Ported from overling.ce
|
|
// Note: This test spawns actors and waits for them.
|
|
// In a sync function test, we can't easily wait for async actor events unless we block/poll.
|
|
// However, the new test runner might expect sync return or a promise (not available yet?).
|
|
// For now, we'll just spawn them to ensure no immediate crashes.
|
|
// Full async testing might require a different approach or `dmon.poll` style loop if events are exposed.
|
|
// Assuming for now that we just verify strict logical errors.
|
|
|
|
var underlingCount = 0;
|
|
var targetCount = 3;
|
|
|
|
// Spawn several underlings
|
|
for (var i = 0; i < targetCount; i++) {
|
|
$start(function(greet) {
|
|
underlingCount++;
|
|
log.console("Underling spawned: " + underlingCount);
|
|
}, "tests/underling_actor", ["test" + i]);
|
|
}
|
|
|
|
// We can't easily wait here without a loop that yields, but this is a single threaded JS env usually.
|
|
// If $delay is async, we return immediately.
|
|
|
|
log.console("Spawned " + targetCount + " underlings (async)");
|
|
}
|
|
}
|