48 lines
1.4 KiB
Plaintext
48 lines
1.4 KiB
Plaintext
var time = use('time')
|
|
|
|
return {
|
|
test_parseq: function() {
|
|
var tree = {
|
|
id: 100,
|
|
children: [
|
|
{
|
|
id: 101,
|
|
children: [
|
|
{ id: 102, children: [] },
|
|
{ id: 103, children: [] }
|
|
]
|
|
},
|
|
{
|
|
id: 104,
|
|
children: [
|
|
{ id: 105, children: [] }
|
|
]
|
|
}
|
|
]
|
|
}
|
|
|
|
var st = time.number()
|
|
var actor
|
|
|
|
// This test depends on 'tests/comments' which we created as 'comments.cm'
|
|
// but 'comments.cm' wraps the actor logic in a function.
|
|
// The original 'comments.ce' was an actor script.
|
|
// We should probably restore 'comments.ce' as 'comments_actor.ce' for this test to work if it relies on spawning it.
|
|
// But 'comments.cm' (the new test file) also has the logic.
|
|
// We need an actor file for $_.start to work with.
|
|
|
|
$_.start(e => {
|
|
if (actor) return
|
|
actor = e.actor
|
|
send(actor, tree, (result, reason) => {
|
|
if (reason)
|
|
log.console(reason)
|
|
else
|
|
log.console(json.encode(result))
|
|
|
|
log.console(`took ${time.number()-st} secs`)
|
|
});
|
|
}, "tests/comments_actor") // We will create this next
|
|
}
|
|
}
|