diff options
author | dgp <dgp@users.sourceforge.net> | 2005-04-22 15:46:39 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2005-04-22 15:46:39 (GMT) |
commit | eea5a1d7018e33f7fa50a613d6a5b912e7bb6707 (patch) | |
tree | 07c4be3b6538e21a3c5f5538a7ef1831f6d9ed9c /tests/obj.test | |
parent | 918dbfe6102b60da44efe1c8344461ad3bddb4b0 (diff) | |
download | tcl-eea5a1d7018e33f7fa50a613d6a5b912e7bb6707.zip tcl-eea5a1d7018e33f7fa50a613d6a5b912e7bb6707.tar.gz tcl-eea5a1d7018e33f7fa50a613d6a5b912e7bb6707.tar.bz2 |
The 2005-04-21 changes to Tcl_GetBooleanFromObj were done to bring
it into agreement with its docs. Further investigation reveals it
was the docs that were incorrect.
* doc/BoolObj.3: Corrections to the documentation of
Tcl_GetBooleanFromObj to bring it into agreement with what this
public interface has always done, including noting the difference
in function between Tcl_GetBooleanFromObj and Tcl_GetBoolean.
* generic/tclGet.c: Revised Tcl_GetBoolean to no longer be a
wrapper around Tcl_GetBooleanFromObj (different function!).
* generic/tclObj.c: Removed TclGetTruthValueFromObj routine
that was added yesterday. Revisions so that only
Tcl_GetBoolean-approved values get the "boolean" Tcl_ObjType.
This retains the fix for [Bug 1187123].
* generic/tclInt.h: Revert most recent change.
* generic/tclBasic.c:
* generic/tclCompCmds.c:
* generic/tclDictObj.c:
* generic/tclExecute.c:
* tests/obj.test:
Diffstat (limited to 'tests/obj.test')
-rw-r--r-- | tests/obj.test | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/tests/obj.test b/tests/obj.test index e0eaa2f..8fe6e2b 100644 --- a/tests/obj.test +++ b/tests/obj.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: obj.test,v 1.12 2005/04/21 20:24:14 dgp Exp $ +# RCS: @(#) $Id: obj.test,v 1.13 2005/04/22 15:47:00 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -202,10 +202,9 @@ test obj-11.1 {Tcl_GetBooleanFromObj, existing boolean object} testobj { test obj-11.2 {Tcl_GetBooleanFromObj, convert to boolean} testobj { set result "" lappend result [testintobj set 1 47] - lappend result [catch {testbooleanobj not 1} msg] - lappend result $msg + lappend result [testbooleanobj not 1] ;# must convert to bool lappend result [testobj type 1] -} {47 1 {expected boolean value but got "47"} int} +} {47 0 boolean} test obj-11.3 {Tcl_GetBooleanFromObj, error converting to boolean} testobj { set result "" lappend result [teststringobj set 1 abc] @@ -221,17 +220,15 @@ test obj-11.4 {Tcl_GetBooleanFromObj, error converting from "empty string"} test test obj-11.5 {Tcl_GetBooleanFromObj, convert hex to boolean} testobj { set result "" lappend result [teststringobj set 1 0xac] - lappend result [catch {testbooleanobj not 1} msg] - lappend result $msg + lappend result [testbooleanobj not 1] lappend result [testobj type 1] -} {0xac 1 {expected boolean value but got "0xac"} string} +} {0xac 0 boolean} test obj-11.6 {Tcl_GetBooleanFromObj, convert float to boolean} testobj { set result "" lappend result [teststringobj set 1 5.42] - lappend result [catch {testbooleanobj not 1} msg] - lappend result $msg + lappend result [testbooleanobj not 1] lappend result [testobj type 1] -} {5.42 1 {expected boolean value but got "5.42"} string} +} {5.42 0 boolean} test obj-12.1 {DupBooleanInternalRep} testobj { set result "" @@ -242,17 +239,16 @@ test obj-12.1 {DupBooleanInternalRep} testobj { test obj-13.1 {SetBooleanFromAny, int to boolean special case} testobj { set result "" - lappend result [testintobj set 1 1] + lappend result [testintobj set 1 1234] lappend result [testbooleanobj not 1] ;# converts with SetBooleanFromAny lappend result [testobj type 1] -} {1 0 boolean} +} {1234 0 boolean} test obj-13.2 {SetBooleanFromAny, double to boolean special case} testobj { set result "" - lappend result [testdoubleobj set 1 0.0] - lappend result [catch {testbooleanobj not 1} msg] - lappend result $msg + lappend result [testdoubleobj set 1 3.14159] + lappend result [testbooleanobj not 1] ;# converts with SetBooleanFromAny lappend result [testobj type 1] -} {0.0 1 {expected boolean value but got "0.0"} double} +} {3.14159 0 boolean} test obj-13.3 {SetBooleanFromAny, special case strings representing booleans} testobj { set result "" foreach s {yes no true false on off} { @@ -263,11 +259,11 @@ test obj-13.3 {SetBooleanFromAny, special case strings representing booleans} te } {0 1 0 1 0 1 boolean} test obj-13.4 {SetBooleanFromAny, recompute string rep then parse it} testobj { set result "" - lappend result [testintobj set 1 16] + lappend result [testintobj set 1 456] lappend result [testintobj div10 1] - lappend result [testbooleanobj not 1] + lappend result [testbooleanobj not 1] ;# converts with SetBooleanFromAny lappend result [testobj type 1] -} {16 1 0 boolean} +} {456 45 0 boolean} test obj-13.5 {SetBooleanFromAny, error parsing string} testobj { set result "" lappend result [teststringobj set 1 abc] |