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