working hostname call
[scpubgit/TenDotTcl.git] / t / connection.t
diff --git a/t/connection.t b/t/connection.t
new file mode 100644 (file)
index 0000000..6ce7931
--- /dev/null
@@ -0,0 +1,22 @@
+BEGIN { exec(tclsh => 't/tcl/harness.tcl' => $0) }
+
+package require ten
+package require json::write
+
+set connector [ten::connector::perl %AUTO%]
+
+set conn [$connector connect]
+
+set f1 [
+  $conn send call [ json::write string class_call_handler ] \
+    0 [ json::write string call ] \
+    [ json::write string Sys::Hostname ] [ json::write string hostname ]
+]
+
+set ready_args ""
+
+$f1 on_ready [list apply {{name future} {set $name [$future get]}} "[namespace current]::ready_args" ]
+
+$f1 await_ready
+
+is $ready_args [exec hostname] "hostname returned ok"