From: Matt S Trout Date: Sun, 5 Aug 2012 16:16:31 +0000 (+0000) Subject: test close handler X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c96546b1929044b494d99203c8844dc33550f41a;p=scpubgit%2FTenDotTcl.git test close handler --- diff --git a/t/bin/echo.pl b/t/bin/echo.pl new file mode 100755 index 0000000..8d5b5c8 --- /dev/null +++ b/t/bin/echo.pl @@ -0,0 +1,8 @@ +#!/usr/bin/env perl + +$|++; + +while () { + exit 0 if $_ eq "DIE\n"; + print; +} diff --git a/t/readch.t b/t/readch.t index c10189a..ed7513b 100644 --- a/t/readch.t +++ b/t/readch.t @@ -2,7 +2,7 @@ BEGIN { exec(tclsh => 't/tcl/harness.tcl' => $0) } package require ten -set tfh [open {|./echo.pl} r+] +set tfh [open {|t/bin/echo.pl} r+] fconfigure $tfh -buffering line @@ -29,10 +29,12 @@ vwait got_line is $got_line bar "Got line from read channel (send after set cb)" -#$rch configure -on_close_call {global got_line; set got_line bye} +$rch configure -on_close_call {global got_line; set got_line bye} -#vwait got_line +puts $tfh DIE -#is $got_line bye "Close handler called" +vwait got_line + +is $got_line bye "Close handler called" done_testing