archie/tcl7.3/tests/cmdinfo.test

80 lines
2.9 KiB
Plaintext
Raw Normal View History

2024-05-27 16:13:40 +02:00
# Commands covered: none
#
# This file contains a collection of tests for Tcl_GetCommandInfo,
# Tcl_SetCommandInfo, Tcl_CreateCommand, and Tcl_DeleteCommand.
# Sourcing this file into Tcl runs the tests and generates output for
# errors. No output means no errors were found.
#
# Copyright (c) 1993 The Regents of the University of California.
# All rights reserved.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and its documentation for any purpose, provided that the
# above copyright notice and the following two paragraphs appear in
# all copies of this software.
#
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
# $Header: /user6/ouster/tcl/tests/RCS/cmdinfo.test,v 1.1 93/07/01 16:23:09 ouster Exp $ (Berkeley)
if {[info commands testcmdinfo] == {}} {
puts "This application hasn't been compiled with the \"testcmdinfo\""
puts "command, so I can't test Tcl_GetCommandInfo etc."
return
}
if {[string compare test [info procs test]] == 1} then {source defs}
test cmdinfo-1.1 {command procedure and clientData} {
testcmdinfo create x1
testcmdinfo get x1
} {CmdProc1 original CmdDelProc1 original}
test cmdinfo-1.2 {command procedure and clientData} {
testcmdinfo create x1
x1
} {CmdProc1 original}
test cmdinfo-1.3 {command procedure and clientData} {
testcmdinfo create x1
testcmdinfo modify x1
testcmdinfo get x1
} {CmdProc2 new_command_data CmdDelProc2 new_delete_data}
test cmdinfo-1.4 {command procedure and clientData} {
testcmdinfo create x1
testcmdinfo modify x1
x1
} {CmdProc2 new_command_data}
test cmdinfo-2.1 {command deletion callbacks} {
testcmdinfo create x1
testcmdinfo delete x1
} {CmdDelProc1 original}
test cmdinfo-2.2 {command deletion callbacks} {
testcmdinfo create x1
testcmdinfo modify x1
testcmdinfo delete x1
} {CmdDelProc2 new_delete_data}
test cmdinfo-3.1 {Tcl_Get/SetCommandInfo return values} {
testcmdinfo get non_existent
} {??}
test cmdinfo-3.2 {Tcl_Get/SetCommandInfo return values} {
testcmdinfo create x1
testcmdinfo modify x1
} 1
test cmdinfo-3.3 {Tcl_Get/SetCommandInfo return values} {
testcmdinfo modify non_existent
} 0
catch {rename x1 ""}
concat {}