initial harness code and read channel
[scpubgit/TenDotTcl.git] / t / readch.t
CommitLineData
3c6a0ce7 1BEGIN { exec(tclsh => 't/tcl/harness.tcl' => $0) }
2
3package require ten
4
5set tfh [open {|./echo.pl} r+]
6
7fconfigure $tfh -buffering line
8
9set rch [ten::read_channel %AUTO% -fh $tfh]
10
11proc line_cb {line} {
12 global got_line
13 set got_line $line
14}
15
16puts $tfh foo
17
18$rch configure -on_line_call line_cb
19
20global got_line
21
22vwait got_line
23
24is $got_line foo "Got line from read channel (send before set cb)"
25
26puts $tfh bar
27
28vwait got_line
29
30is $got_line bar "Got line from read channel (send after set cb)"
31
32done_testing
33