basic future tests
[scpubgit/TenDotTcl.git] / t / future.t
index ef9ae98..28cfd7a 100644 (file)
@@ -9,12 +9,22 @@ ok {![f1 is_ready]} "Future not yet ready"
 set ready_args ""
 set done_args ""
 
-f1 on_ready {set "[namespace current]::ready_args"}
+f1 on_ready [list set "[namespace current]::ready_args"]
 
-f1 on_done {set "[namespace current]::done_args"}
+f1 on_done [list set "[namespace current]::done_args"]
 
 f1 done foo bar
 
 ok {[f1 is_ready]} "Future ready"
 
+is $ready_args {::f1} "Future passed to ready"
+
+cmp_ok == [llength $done_args] 2 "Both args passed to done"
+
+is [lindex $done_args 0] foo "Right first arg"
+
+is [lindex $done_args 1] bar "Right second arg"
+
+is [f1 get] "foo bar" "get return ok"
+
 done_testing