os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/winConsole.test
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 (c) 1999 by 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 #
    12 # RCS: @(#) $Id: winConsole.test,v 1.5 2000/04/10 17:19:06 ericm Exp $
    13 
    14 if {[lsearch [namespace children] ::tcltest] == -1} {
    15     package require tcltest
    16     namespace import -force ::tcltest::*
    17 }
    18 
    19 
    20 test winConsole-1.1 {Console file channel: non-blocking gets} \
    21 	{pcOnly interactive} {
    22     
    23     set oldmode [fconfigure stdin]
    24 
    25     puts stdout "Enter abcdef<return> now: " nonewline
    26     flush stdout
    27     fileevent stdin readable {
    28 	if {[gets stdin line] >= 0} {
    29 	    set result $line
    30 	} else {
    31 	    set result "gets failed"
    32 	}
    33     }
    34 
    35     fconfigure stdin -blocking 0 -buffering line
    36 
    37     set result {}
    38     vwait result
    39 
    40     #cleanup the fileevent
    41     fileevent stdin readable {}
    42     eval fconfigure stdin $oldmode
    43 
    44     set result
    45 
    46 }  "abcdef"
    47 
    48 #cleanup
    49 
    50 ::tcltest::cleanupTests
    51 return
    52