From: Matt S Trout Date: Sun, 9 Sep 2012 16:46:16 +0000 (+0000) Subject: factor out remote_object method X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=451af734a02bd95ae80362af9e0a4f6b6e4ee34e;hp=2cecba5d55ca5249b4c3bbc4b388ddf85d739f72;p=scpubgit%2FTenDotTcl.git factor out remote_object method --- diff --git a/t/connection.t b/t/connection.t index 7c28bc7..1a1ab72 100644 --- a/t/connection.t +++ b/t/connection.t @@ -39,14 +39,16 @@ set ortestdata [[$conn send call {*}[jws class_call_handler 0 call ORTestClass n set ortestoid [lindex $ortestdata 0 1] -ten::handle ortest -id $ortestoid -connection $conn +set ortest [$conn remote_object $ortestoid] -cmp_ok != [pid] [ortest call pid] "pid is different on the other side" +cmp_ok != [pid] [$ortest call pid] "pid is different on the other side" -is [ortest call counter] 0 "Counter at 0" +is [$ortest call counter] 0 "Counter at 0" -is [ortest call increment] 1 "Incrememt to 1" +is [$ortest call increment] 1 "Incrememt to 1" -is [ortest call counter] 1 "Counter at 1" +is [$ortest call counter] 1 "Counter at 1" + +$ortest destroy done_testing diff --git a/ten/ten.tcl b/ten/ten.tcl index 988915d..fed99af 100644 --- a/ten/ten.tcl +++ b/ten/ten.tcl @@ -93,6 +93,11 @@ snit::type ten::connection { set send_this [ json::write array {*}$to_send ] puts $options(-send_to_fh) $send_this } + + method remote_object {id} { + return [ten::handle %AUTO% -connection $self -id $id] + } + } snit::type ten::future {