timeout test
Matt S Trout [Fri, 20 Jul 2012 19:22:48 +0000 (19:22 +0000)]
Changes
t/timeout.t [new file with mode: 0644]

diff --git a/Changes b/Changes
index be4beb9..9240d01 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,4 @@
+  - timeouts for connection setup
   - support Object::Remote->start::connect
   - timer support in MiniLoop
 
diff --git a/t/timeout.t b/t/timeout.t
new file mode 100644 (file)
index 0000000..dba6c62
--- /dev/null
@@ -0,0 +1,16 @@
+use strictures 1;
+use Test::More;
+
+use Object::Remote;
+use Object::Remote::Connector::Local;
+
+my $connector = Object::Remote::Connector::Local->new(
+  timeout => { after => 0.1 },
+  perl_command => [ 'perl', '-e', 'sleep 3' ],
+);
+
+ok(!eval { $connector->connect; 1 }, 'Connection failed');
+
+like($@, qr{timed out}, 'Connection failed with time out');
+
+done_testing;