update actor doc and add more actor based tests

This commit is contained in:
2026-02-17 11:50:46 -06:00
parent 2d054fcf21
commit 2be2b15a61
21 changed files with 268 additions and 51 deletions

30
tests/actor_requestors.ce Normal file
View File

@@ -0,0 +1,30 @@
// Test: sequence, parallel, and fallback requestor composition
var immediate = function(callback, value) {
callback(42)
}
var add_one = function(callback, value) {
callback(value + 1)
}
var broken = function(callback, value) {
callback(null, "broken")
}
var _t = sequence([immediate, add_one])(function(result, reason) {
if (reason != null) disrupt
if (result != 43) disrupt
parallel([immediate, immediate])(function(results, reason) {
if (reason != null) disrupt
if (length(results) != 2) disrupt
if (results[0] != 42) disrupt
if (results[1] != 42) disrupt
fallback([broken, immediate])(function(result, reason) {
if (reason != null) disrupt
if (result != 42) disrupt
$stop()
})
})
})