File: chained.t

package info (click to toggle)
libobject-remote-perl 0.003004-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 408 kB
  • ctags: 221
  • sloc: perl: 2,365; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 885 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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';
}