1# 2# cmdloop.test 3# 4# Tests for the commandloop command. 5#--------------------------------------------------------------------------- 6# Copyright 1992-1999 Karl Lehenbauer and Mark Diekhans. 7# 8# Permission to use, copy, modify, and distribute this software and its 9# documentation for any purpose and without fee is hereby granted, provided 10# that the above copyright notice appear in all copies. Karl Lehenbauer and 11# Mark Diekhans make no representations about the suitability of this 12# software for any purpose. It is provided "as is" without express or 13# implied warranty. 14#------------------------------------------------------------------------------ 15# $Id: cmdloop.test,v 1.2 2002/04/02 02:29:43 hobbs Exp $ 16#------------------------------------------------------------------------------ 17# 18 19if {[cequal [info procs Test] {}]} { 20 source [file join [file dirname [info script]] testlib.tcl] 21} 22 23Test cmdloop-1.1 {commandloop tests} { 24 commandloop xxx 25} 1 {wrong # args: commandloop ?-async? ?-interactive on|off|tty? ?-prompt1 cmd? ?-prompt2 cmd? ?-endcommand cmd?} 26 27Test cmdloop-1.2 {commandloop tests} { 28 commandloop -arf 29} 1 {unknown option "-arf", expected one of "-async", "-interactive", "-prompt1", "-prompt2", or "-endcommand"} 30 31Test cmdloop-1.3 {commandloop tests} { 32 commandloop -interactive foo 33} 1 {expected boolean value but got "foo"} 34 35Test cmdloop-1.4 {commandloop tests} { 36 commandloop -prompt1 37} 1 {argument required for -prompt1 option} 38 39Test cmdloop-1.5 {commandloop tests} { 40 commandloop -prompt2 41} 1 {argument required for -prompt2 option} 42 43Test cmdloop-1.6 {commandloop tests} { 44 commandloop -prompt2 x y 45} 1 {wrong # args: commandloop ?-async? ?-interactive on|off|tty? ?-prompt1 cmd? ?-prompt2 cmd? ?-endcommand cmd?} 46 47Test cmdloop-1.7 {commandloop tests} { 48 commandloop -endcommand 49} 1 {argument required for -endcommand option} 50 51# 52# More tests need. To make this easy, we need a quit command to exit 53# a command loop without exiting the interp. Quit must only exit a 54# command loop associated with a particular interp, so setting a 55# global is not the easy way to go. 56# 57 58 59 60