X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fbasic.t;h=b8fee8e9cd8c12e3acb43f01771715036c7440a0;hb=4e4463355a9ec6afdc7983ee36daa9f11306d4fc;hp=77f0c69da312a1d8ac902a4f85b643b2a4ab3cfe;hpb=b63a955fda065430b5e0e2c37b07ba292ecc7e28;p=scpubgit%2FObject-Remote.git diff --git a/t/basic.t b/t/basic.t index 77f0c69..b8fee8e 100644 --- a/t/basic.t +++ b/t/basic.t @@ -1,28 +1,39 @@ use strictures 1; use Test::More; +use Sys::Hostname qw(hostname); + +require 't/logsetup.pl'; -use Object::Remote::Connector::Local; use Object::Remote; $ENV{PERL5LIB} = join( ':', ($ENV{PERL5LIB} ? $ENV{PERL5LIB} : ()), qw(lib t/lib) ); -my $connection = Object::Remote::Connector::Local->new->connect; +my $connection = Object::Remote->connect('-'); #$Object::Remote::Connection::DEBUG = 1; -my $proxy = Object::Remote->new( - connection => $connection, - class => 'ORTestClass' -)->proxy; +my $remote = ORTestClass->new::on($connection); + +isnt($$, $remote->pid, 'Different pid on the other side'); + +is($remote->counter, 0, 'Counter at 0'); -isnt($$, $proxy->pid, 'Different pid on the other side'); +is($remote->increment, 1, 'Increment to 1'); -is($proxy->counter, 0, 'Counter at 0'); +is($remote->counter, 1, 'Counter at 1'); -is($proxy->increment, 1, 'Increment to 1'); +my $x = 0; -is($proxy->counter, 1, 'Counter at 1'); +is($remote->call_callback(27, sub { $x++ }), 27, "Callback ok"); + +is($x, 1, "Callback called callback"); + +is( + Sys::Hostname->can::on($connection, 'hostname')->(), + hostname(), + 'Remote sub call ok' +); done_testing;