From e3d20a2783044861949b7a0230410548b1c59982 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 22 Apr 2005 16:29:57 +0000 Subject: * generic/tclCmdMZ.c: Corrected intrep-dependence of * tests/string.test: [string is boolean] [Bug 1187123] --- ChangeLog | 5 +++++ generic/tclCmdMZ.c | 12 +++--------- tests/string.test | 11 ++++++++++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b676f7..eaecb51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-04-22 Don Porter + + * generic/tclCmdMZ.c: Corrected intrep-dependence of + * tests/string.test: [string is boolean] [Bug 1187123] + 2005-04-22 Daniel Steffen * tests/unixInit.test (7.1): fixed failure when running tests diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ce28e54..45a2bed 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.82.2.15 2005/03/18 16:33:42 dgp Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.82.2.16 2005/04/22 16:30:02 dgp Exp $ */ #include "tclInt.h" @@ -1592,14 +1592,8 @@ Tcl_StringObjCmd(dummy, interp, objc, objv) case STR_IS_BOOL: case STR_IS_TRUE: case STR_IS_FALSE: - if (objPtr->typePtr == &tclBooleanType) { - if ((((enum isOptions) index == STR_IS_TRUE) && - objPtr->internalRep.longValue == 0) || - (((enum isOptions) index == STR_IS_FALSE) && - objPtr->internalRep.longValue != 0)) { - result = 0; - } - } else if ((Tcl_GetBoolean(NULL, string1, &i) + /* Optimizers, beware Bug 1187123 ! */ + if ((Tcl_GetBoolean(NULL, string1, &i) == TCL_ERROR) || (((enum isOptions) index == STR_IS_TRUE) && i == 0) || diff --git a/tests/string.test b/tests/string.test index a48df1c..71e94ec 100644 --- a/tests/string.test +++ b/tests/string.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: string.test,v 1.36.2.3 2004/08/30 18:15:25 dkf Exp $ +# RCS: @(#) $Id: string.test,v 1.36.2.4 2005/04/22 16:30:10 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -23,6 +23,8 @@ if {[lsearch [namespace children] ::tcltest] == -1} { set ::tcltest::testConstraints(testobj) \ [expr {[info commands testobj] != {}}] +set ::tcltest::testConstraints(testindexobj) \ + [expr {[info commands testindexobj] != {}}] test string-1.1 {error conditions} { list [catch {string gorp a b} msg] $msg @@ -1340,6 +1342,13 @@ test string-22.13 {string wordstart, unicode} { string wordstart "\uc700\uc700 abc" 8 } 3 +test string-23.0 {string is boolean, Bug 1187123} testindexobj { + set x 5 + catch {testindexobj $x foo bar soom} + string is boolean $x +} 0 + + # cleanup ::tcltest::cleanupTests return -- cgit v0.12