Commit | Line | Data |
15e006dc |
1 | BEGIN { exec(tclsh => 't/tcl/harness.tcl' => $0) } |
2 | |
3 | package require ten |
4 | |
5 | ten::future f1 |
6 | |
7 | ok {![f1 is_ready]} "Future not yet ready" |
8 | |
9 | set ready_args "" |
10 | set done_args "" |
11 | |
b0dd2971 |
12 | f1 on_ready [list set "[namespace current]::ready_args"] |
15e006dc |
13 | |
b0dd2971 |
14 | f1 on_done [list set "[namespace current]::done_args"] |
15e006dc |
15 | |
16 | f1 done foo bar |
17 | |
18 | ok {[f1 is_ready]} "Future ready" |
19 | |
b0dd2971 |
20 | is $ready_args {::f1} "Future passed to ready" |
21 | |
22 | cmp_ok == [llength $done_args] 2 "Both args passed to done" |
23 | |
24 | is [lindex $done_args 0] foo "Right first arg" |
25 | |
26 | is [lindex $done_args 1] bar "Right second arg" |
27 | |
28 | is [f1 get] "foo bar" "get return ok" |
29 | |
15e006dc |
30 | done_testing |