X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=blobdiff_plain;f=t%2Fchained.t;fp=t%2Fchained.t;h=4d99de2b009c1fdf1e1b904d2db87d6988ddaddb;hp=0000000000000000000000000000000000000000;hb=8c3529062a426181861d58ee59fb8f10e0be68e5;hpb=1673aa538a25ee18a7e8b2af7d039f989f71c737 diff --git a/t/chained.t b/t/chained.t new file mode 100644 index 0000000..4d99de2 --- /dev/null +++ b/t/chained.t @@ -0,0 +1,44 @@ +use strictures 1; +use Test::More; + +$ENV{OBJECT_REMOTE_TEST_LOGGER} = 1; + +use Object::Remote; +use Object::Remote::FromData; + +my $conn1 = Reconnector->new::on('-'); +my $conn2 = $conn1->connect; + +isa_ok($conn1, 'Object::Remote::Proxy'); +isa_ok($conn2, 'Object::Remote::Proxy'); + +my $root_pid = $$; +my $conn1_pid = $conn1->pid; +my $conn2_pid = $conn2->pid; + +ok($root_pid != $conn1_pid, "Root and conn1 are not the same interpreter instance"); +ok($root_pid != $conn2_pid, "Root and conn2 are not the same interpreter instance"); +ok($conn1_pid != $conn2_pid, "conn1 and conn2 are not the same interpreter instance"); + +ok($conn1->ping eq "pong", "Ping success on conn1"); +ok($conn2->ping eq "pong", "Ping success on conn2"); + +done_testing; + +__DATA__ + +package Reconnector; + +use Moo; + +sub connect { + return Reconnector->new::on('-'); +} + +sub pid { + return $$; +} + +sub ping { + return 'pong'; +}