os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/winConsole.test
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/winConsole.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,52 @@
1.4 +# This file tests the tclWinConsole.c file.
1.5 +#
1.6 +# This file contains a collection of tests for one or more of the Tcl
1.7 +# built-in commands. Sourcing this file into Tcl runs the tests and
1.8 +# generates output for errors. No output means no errors were found.
1.9 +#
1.10 +# Copyright (c) 1999 by Scriptics Corporation.
1.11 +#
1.12 +# See the file "license.terms" for information on usage and redistribution
1.13 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1.14 +#
1.15 +# RCS: @(#) $Id: winConsole.test,v 1.5 2000/04/10 17:19:06 ericm Exp $
1.16 +
1.17 +if {[lsearch [namespace children] ::tcltest] == -1} {
1.18 + package require tcltest
1.19 + namespace import -force ::tcltest::*
1.20 +}
1.21 +
1.22 +
1.23 +test winConsole-1.1 {Console file channel: non-blocking gets} \
1.24 + {pcOnly interactive} {
1.25 +
1.26 + set oldmode [fconfigure stdin]
1.27 +
1.28 + puts stdout "Enter abcdef<return> now: " nonewline
1.29 + flush stdout
1.30 + fileevent stdin readable {
1.31 + if {[gets stdin line] >= 0} {
1.32 + set result $line
1.33 + } else {
1.34 + set result "gets failed"
1.35 + }
1.36 + }
1.37 +
1.38 + fconfigure stdin -blocking 0 -buffering line
1.39 +
1.40 + set result {}
1.41 + vwait result
1.42 +
1.43 + #cleanup the fileevent
1.44 + fileevent stdin readable {}
1.45 + eval fconfigure stdin $oldmode
1.46 +
1.47 + set result
1.48 +
1.49 +} "abcdef"
1.50 +
1.51 +#cleanup
1.52 +
1.53 +::tcltest::cleanupTests
1.54 +return
1.55 +