From 8c1e2324b5a38eb0a82c1c36025010cd62884fc5 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 19 May 2004 12:15:04 +0000 Subject: Convert conditional tests into constrained tests --- tests/indexObj.test | 69 ++++++++++++++++++++--------------------------------- tests/listObj.test | 23 +++--------------- 2 files changed, 29 insertions(+), 63 deletions(-) diff --git a/tests/indexObj.test b/tests/indexObj.test index 9a8a582..70740f7 100644 --- a/tests/indexObj.test +++ b/tests/indexObj.test @@ -8,101 +8,96 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: indexObj.test,v 1.7 2000/11/24 11:27:38 dkf Exp $ +# RCS: @(#) $Id: indexObj.test,v 1.8 2004/05/19 12:17:31 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest namespace import -force ::tcltest::* } -if {[info commands testindexobj] == {}} { - puts "This application hasn't been compiled with the \"testindexobj\"" - puts "command, so I can't test Tcl_GetIndexFromObj etc." - ::tcltest::cleanupTests - return -} +testConstraint testindexobj [llength [info commands testindexobj]] -test indexObj-1.1 {exact match} { +test indexObj-1.1 {exact match} testindexobj { testindexobj 1 1 xyz abc def xyz alm } {2} -test indexObj-1.2 {exact match} { +test indexObj-1.2 {exact match} testindexobj { testindexobj 1 1 abc abc def xyz alm } {0} -test indexObj-1.3 {exact match} { +test indexObj-1.3 {exact match} testindexobj { testindexobj 1 1 alm abc def xyz alm } {3} -test indexObj-1.4 {unique abbreviation} { +test indexObj-1.4 {unique abbreviation} testindexobj { testindexobj 1 1 xy abc def xalb xyz alm } {3} -test indexObj-1.5 {multiple abbreviations and exact match} { +test indexObj-1.5 {multiple abbreviations and exact match} testindexobj { testindexobj 1 1 x abc def xalb xyz alm x } {5} -test indexObj-1.6 {forced exact match} { +test indexObj-1.6 {forced exact match} testindexobj { testindexobj 1 0 xy abc def xalb xy alm } {3} -test indexObj-1.7 {forced exact match} { +test indexObj-1.7 {forced exact match} testindexobj { testindexobj 1 0 x abc def xalb xyz alm x } {5} -test indexObj-2.1 {no match} { +test indexObj-2.1 {no match} testindexobj { list [catch {testindexobj 1 1 dddd abc def xalb xyz alm x} msg] $msg } {1 {bad token "dddd": must be abc, def, xalb, xyz, alm, or x}} -test indexObj-2.2 {no match} { +test indexObj-2.2 {no match} testindexobj { list [catch {testindexobj 1 1 dddd abc} msg] $msg } {1 {bad token "dddd": must be abc}} -test indexObj-2.3 {no match: no abbreviations} { +test indexObj-2.3 {no match: no abbreviations} testindexobj { list [catch {testindexobj 1 0 xy abc def xalb xyz alm} msg] $msg } {1 {bad token "xy": must be abc, def, xalb, xyz, or alm}} -test indexObj-2.4 {ambiguous value} { +test indexObj-2.4 {ambiguous value} testindexobj { list [catch {testindexobj 1 1 d dumb daughter a c} msg] $msg } {1 {ambiguous token "d": must be dumb, daughter, a, or c}} -test indexObj-2.5 {omit error message} { +test indexObj-2.5 {omit error message} testindexobj { list [catch {testindexobj 0 1 d x} msg] $msg } {1 {}} -test indexObj-3.1 {cache result to skip next lookup} { +test indexObj-3.1 {cache result to skip next lookup} testindexobj { testindexobj check 42 } {42} -test indexObj-4.1 {free old internal representation} { +test indexObj-4.1 {free old internal representation} testindexobj { set x {a b} lindex $x 1 testindexobj 1 1 $x abc def {a b} zzz } {2} -test indexObj-5.1 {Tcl_WrongNumArgs} { +test indexObj-5.1 {Tcl_WrongNumArgs} testindexobj { testwrongnumargs 1 "?option?" mycmd } "wrong # args: should be \"mycmd ?option?\"" -test indexObj-5.2 {Tcl_WrongNumArgs} { +test indexObj-5.2 {Tcl_WrongNumArgs} testindexobj { testwrongnumargs 2 "bar" mycmd foo } "wrong # args: should be \"mycmd foo bar\"" -test indexObj-5.3 {Tcl_WrongNumArgs} { +test indexObj-5.3 {Tcl_WrongNumArgs} testindexobj { testwrongnumargs 0 "bar" mycmd foo } "wrong # args: should be \"bar\"" -test indexObj-5.4 {Tcl_WrongNumArgs} { +test indexObj-5.4 {Tcl_WrongNumArgs} testindexobj { testwrongnumargs 0 "" mycmd foo } "wrong # args: should be \"\"" -test indexObj-5.5 {Tcl_WrongNumArgs} { +test indexObj-5.5 {Tcl_WrongNumArgs} testindexobj { testwrongnumargs 1 "" mycmd foo } "wrong # args: should be \"mycmd\"" -test indexObj-5.6 {Tcl_WrongNumArgs} { +test indexObj-5.6 {Tcl_WrongNumArgs} testindexobj { testwrongnumargs 2 "" mycmd foo } "wrong # args: should be \"mycmd foo\"" -test indexObj-6.1 {Tcl_GetIndexFromObjStruct} { +test indexObj-6.1 {Tcl_GetIndexFromObjStruct} testindexobj { set x a testgetindexfromobjstruct $x 0 } "wrong # args: should be \"testgetindexfromobjstruct a 0\"" -test indexObj-6.2 {Tcl_GetIndexFromObjStruct} { +test indexObj-6.2 {Tcl_GetIndexFromObjStruct} testindexobj { set x a testgetindexfromobjstruct $x 0 testgetindexfromobjstruct $x 0 } "wrong # args: should be \"testgetindexfromobjstruct a 0\"" -test indexObj-6.3 {Tcl_GetIndexFromObjStruct} { +test indexObj-6.3 {Tcl_GetIndexFromObjStruct} testindexobj { set x c testgetindexfromobjstruct $x 1 } "wrong # args: should be \"testgetindexfromobjstruct c 1\"" -test indexObj-6.4 {Tcl_GetIndexFromObjStruct} { +test indexObj-6.4 {Tcl_GetIndexFromObjStruct} testindexobj { set x c testgetindexfromobjstruct $x 1 testgetindexfromobjstruct $x 1 @@ -111,15 +106,3 @@ test indexObj-6.4 {Tcl_GetIndexFromObjStruct} { # cleanup ::tcltest::cleanupTests return - - - - - - - - - - - - diff --git a/tests/listObj.test b/tests/listObj.test index a240dec..fd11c24 100644 --- a/tests/listObj.test +++ b/tests/listObj.test @@ -11,22 +11,17 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: listObj.test,v 1.5 2000/04/10 17:19:01 ericm Exp $ +# RCS: @(#) $Id: listObj.test,v 1.6 2004/05/19 12:15:04 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest namespace import -force ::tcltest::* } -if {[info commands testobj] == {}} { - puts "This application hasn't been compiled with the \"testobj\"" - puts "command, so I can't test the Tcl type and object support." - ::tcltest::cleanupTests - return -} +testConstraint testobj [llength [info commands testobj]] catch {unset x} -test listobj-1.1 {Tcl_GetListObjType} { +test listobj-1.1 {Tcl_GetListObjType} testobj { set t [testobj types] set first [string first "list" $t] set result [expr {$first != -1}] @@ -186,15 +181,3 @@ test listobj-9.1 {UpdateStringOfList} { # cleanup ::tcltest::cleanupTests return - - - - - - - - - - - - -- cgit v0.12