1# This file tests the tclWinConsole.c file. 2# 3# This file contains a collection of tests for one or more of the Tcl 4# built-in commands. Sourcing this file into Tcl runs the tests and 5# generates output for errors. No output means no errors were found. 6# 7# Copyright © 1999 Scriptics Corporation. 8# 9# See the file "license.terms" for information on usage and redistribution 10# of this file, and for a DISCLAIMER OF ALL WARRANTIES. 11 12if {"::tcltest" ni [namespace children]} { 13 package require tcltest 2.5 14 namespace import -force ::tcltest::* 15} 16 17 18test winConsole-1.1 {Console file channel: non-blocking gets} {win interactive} { 19 set oldmode [fconfigure stdin] 20 21 puts stdout "Enter abcdef<return> now: " nonewline 22 flush stdout 23 fileevent stdin readable { 24 if {[gets stdin line] >= 0} { 25 set result $line 26 } else { 27 set result "gets failed" 28 } 29 } 30 31 fconfigure stdin -blocking 0 -buffering line 32 33 set result {} 34 vwait result 35 36 #cleanup the fileevent 37 fileevent stdin readable {} 38 fconfigure stdin {*}$oldmode 39 40 set result 41 42} "abcdef" 43 44#cleanup 45 46::tcltest::cleanupTests 47return 48 49