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