#
# cmdloop.test
#
# Tests for the commandloop command.
#---------------------------------------------------------------------------
# Copyright 1992-1999 Karl Lehenbauer and Mark Diekhans.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies.  Karl Lehenbauer and
# Mark Diekhans make no representations about the suitability of this
# software for any purpose.  It is provided "as is" without express or
# implied warranty.
#------------------------------------------------------------------------------
# $Id: cmdloop.test,v 1.2 2002/04/02 02:29:43 hobbs Exp $
#------------------------------------------------------------------------------
#

if {[cequal [info procs Test] {}]} {
    source [file join [file dirname [info script]] testlib.tcl]
}

Test cmdloop-1.1 {commandloop tests} {
    commandloop xxx
} 1 {wrong # args: commandloop ?-async? ?-interactive on|off|tty? ?-prompt1 cmd? ?-prompt2 cmd? ?-endcommand cmd?}

Test cmdloop-1.2 {commandloop tests} {
    commandloop -arf
} 1 {unknown option "-arf", expected one of "-async", "-interactive", "-prompt1", "-prompt2",  or "-endcommand"}

Test cmdloop-1.3 {commandloop tests} {
    commandloop -interactive foo
} 1 {expected boolean value but got "foo"}

Test cmdloop-1.4 {commandloop tests} {
    commandloop -prompt1
} 1 {argument required for -prompt1 option}

Test cmdloop-1.5 {commandloop tests} {
    commandloop -prompt2
} 1 {argument required for -prompt2 option}

Test cmdloop-1.6 {commandloop tests} {
    commandloop -prompt2 x y
} 1 {wrong # args: commandloop ?-async? ?-interactive on|off|tty? ?-prompt1 cmd? ?-prompt2 cmd? ?-endcommand cmd?}

Test cmdloop-1.7 {commandloop tests} {
    commandloop -endcommand
} 1 {argument required for -endcommand option}

#
# More tests need.  To make this easy, we need a quit command to exit
# a command loop without exiting the interp.  Quit must only exit a
# command loop associated with a particular interp, so setting a
# global is not the easy way to go.
#



