0289dc0708d660245199b4af6ac82a0446176c98
[scpubgit/Object-Remote.git] / t / basic.t
1 use strictures 1;
2 use Test::More;
3 use Sys::Hostname qw(hostname);
4
5 use Object::Remote;
6
7 $ENV{PERL5LIB} = join(
8   ':', ($ENV{PERL5LIB} ? $ENV{PERL5LIB} : ()), qw(lib t/lib)
9 );
10
11 my $connection = Object::Remote->connect('-');
12
13 #$Object::Remote::Connection::DEBUG = 1;
14
15 my $remote = ORTestClass->new::on($connection);
16
17 isnt($$, $remote->pid, 'Different pid on the other side');
18
19 is($remote->counter, 0, 'Counter at 0');
20
21 is($remote->increment, 1, 'Increment to 1');
22
23 is($remote->counter, 1, 'Counter at 1');
24
25 my $x = 0;
26
27 is($remote->call_callback(27, sub { $x++ }), 27, "Callback ok");
28
29 is($x, 1, "Callback called callback");
30
31 is(
32   $connection->get_remote_sub('Sys::Hostname::hostname')->(),
33   hostname(),
34   'Remote sub call ok'
35 );
36
37 done_testing;