From: Christian Walde Date: Tue, 18 Jun 2013 20:54:42 +0000 (+0200) Subject: added test for leaks of ssh's STDIN filehandle X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fleak_test;p=scpubgit%2FObject-Remote.git added test for leaks of ssh's STDIN filehandle --- diff --git a/t/leak.t b/t/leak.t new file mode 100644 index 0000000..b25bf1a --- /dev/null +++ b/t/leak.t @@ -0,0 +1,24 @@ +use strictures; + +use Test::More; + +use Scalar::Util 'weaken'; +use Object::Remote::FromData; + +my $conn_ref; +{ + my $conn = Object::Remote->connect( '-' ); + $conn_ref = \( $conn->{send_to_fh} ); + weaken $conn_ref; + is My::TestClass->new::on( $conn )->run, 3, "correct output"; +} +sleep 3; +is $$conn_ref, undef, "filehandle to ssh's STDIN is garbage-collected"; + +done_testing; + +__DATA__ + +package My::TestClass; +use Moo; +sub run { "3" }