LeOS-Genesis/external/badvpn/ncd/tests/depend_scope.ncd

32 lines
734 B
Plaintext

process main {
depend_scope() scope;
var("0") x;
process_manager() mgr;
var("false") backtrack_check;
backtrack_point() point;
If (backtrack_check) {
val_equal(x, "2") a; # must not have rebound temporarily to A during backtracking
assert(a);
exit("0");
};
scope->provide("A");
mgr->start("t1", "t1", {});
val_equal(x, "1") a; # must have bound to A immediately
assert(a);
scope->provide("B") mgr;
val_equal(x, "2") a; # must have rebound to B immediately
assert(a);
backtrack_check->set("true");
point->go();
}
template t1 {
_caller.scope->depend({"B", "A"}) dep;
num_add(dep.x, "1") new_x;
dep.x->set(new_x);
}