1 BEGIN { exec(tclsh => 't/tcl/harness.tcl' => $0) }
7 ok {![f1 is_ready]} "Future not yet ready"
11 set do_not_set_this ""
13 f1 on_ready [list set "[namespace current]::ready_args"]
15 f1 on_done [list set "[namespace current]::done_args"]
17 f1 on_fail [list set "[namespace current]::do_not_set_this"]
21 ok {[f1 is_ready]} "Future ready"
23 is $ready_args {::f1} "Future passed to ready"
25 cmp_ok == [llength $done_args] 2 "Both args passed to done"
27 is [lindex $done_args 0] foo "Right first arg"
29 is [lindex $done_args 1] bar "Right second arg"
31 is $do_not_set_this "" "on_fail not called"
33 is [f1 get] "foo bar" "get return ok"
43 f2 on_done [list set "[namespace current]::done_args"]
45 is $done_args "one two three" "on_done called on completed future"
49 f2 on_ready [list set "[namespace current]::ready_args"]
51 is $ready_args {::f2} "on_ready called on completed future"
53 set do_not_set_this ""
55 f2 on_fail [list set "[namespace current]::do_not_set_this"]
57 is $do_not_set_this "" "on_fail not called on completed future"