summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2002-04-26 08:43:38 (GMT)
committerdkf <dkf@noemail.net>2002-04-26 08:43:38 (GMT)
commit948420467d7d2884e596bbc2854501e598139f22 (patch)
treec12260f9860b76cc2c6cee8c04190b5b5042c834
parent7d3659f8f76e3763bd1e9971a6fb7354f57c0fa2 (diff)
downloadtcl-948420467d7d2884e596bbc2854501e598139f22.zip
tcl-948420467d7d2884e596bbc2854501e598139f22.tar.gz
tcl-948420467d7d2884e596bbc2854501e598139f22.tar.bz2
Added more thorough tests for handling of conversion to boolean.
FossilOrigin-Name: 38b687e90542769a90703ceed7c5210237ae5574
-rw-r--r--ChangeLog2
-rw-r--r--tests/obj.test14
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c769e48..8955a24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2002-04-26 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+ * tests/obj.test (obj-11.[56]): Test conversion to boolean more
+ thoroughly.
* generic/tclObj.c (SetBooleanFromAny): Was not calling an integer
parsing function on native 64-bit platforms! [Bug 548686]
diff --git a/tests/obj.test b/tests/obj.test
index 8512049..c4ec7d4 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.6 2001/11/14 23:16:36 hobbs Exp $
+# RCS: @(#) $Id: obj.test,v 1.7 2002/04/26 08:43:38 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -197,6 +197,18 @@ test obj-11.4 {Tcl_GetBooleanFromObj, error converting from "empty string"} {
lappend result [catch {testbooleanobj not 1} msg]
lappend result $msg
} {{} 1 {expected boolean value but got ""}}
+test obj-11.5 {Tcl_GetBooleanFromObj, convert hex to boolean} {
+ set result ""
+ lappend result [teststringobj set 1 0xac]
+ lappend result [testbooleanobj not 1]
+ lappend result [testobj type 1]
+} {0xac 0 boolean}
+test obj-11.6 {Tcl_GetBooleanFromObj, convert float to boolean} {
+ set result ""
+ lappend result [teststringobj set 1 5.42]
+ lappend result [testbooleanobj not 1]
+ lappend result [testobj type 1]
+} {5.42 0 boolean}
test obj-12.1 {DupBooleanInternalRep} {
set result ""