From: Tyler Riddle Date: Wed, 5 Dec 2012 18:52:06 +0000 (-0800) Subject: new test to validate connection inside a connection works X-Git-Tag: v0.003001_01~49 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d3944ab9d1b5cb283a574395e052bcdfaa02f0cd;p=scpubgit%2FObject-Remote.git new test to validate connection inside a connection works --- diff --git a/t/reconnect.t b/t/reconnect.t new file mode 100644 index 0000000..2b5473b --- /dev/null +++ b/t/reconnect.t @@ -0,0 +1,42 @@ +use strictures 1; +use Test::More; + +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'; +} \ No newline at end of file