summaryrefslogtreecommitdiffstats
path: root/tests/format.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2003-05-14 23:01:55 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2003-05-14 23:01:55 (GMT)
commit1ad94c0d2671be35fab7703ec267713ffae9a7be (patch)
treecb32e64731eef59ecc4e9b6f2854dc5dd4e170cf /tests/format.test
parent5fca09d9090a00e5078e577570942955451d7736 (diff)
downloadtcl-1ad94c0d2671be35fab7703ec267713ffae9a7be.zip
tcl-1ad94c0d2671be35fab7703ec267713ffae9a7be.tar.gz
tcl-1ad94c0d2671be35fab7703ec267713ffae9a7be.tar.bz2
Consequent fixes from [Bug 699060]; [format] should not be too eager to demote
wides to ints, and should throw errors when appropriate.
Diffstat (limited to 'tests/format.test')
-rw-r--r--tests/format.test25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/format.test b/tests/format.test
index 909c993..487f6c5 100644
--- a/tests/format.test
+++ b/tests/format.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: format.test,v 1.11.2.3 2003/03/27 13:11:11 dkf Exp $
+# RCS: @(#) $Id: format.test,v 1.11.2.4 2003/05/14 23:01:56 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -512,6 +512,29 @@ test format-17.5 {type conversions with wides} {
lappend result [expr {$a == $b}]
} {1 1}
+test format-18.1 {do not demote existing numeric values} {
+ set a 0xaaaaaaaa
+ # Ensure $a and $b are separate objects
+ set b 0xaaaa
+ append b aaaa
+
+ set result [expr {$a == $b}]
+ format %08lx $b
+ lappend result [expr {$a == $b}]
+
+ set b 0xaaaa
+ append b aaaa
+
+ lappend result [expr {$a == $b}]
+ format %08x $b
+ lappend result [expr {$a == $b}]
+} {1 1 1 1}
+test format-18.2 {do not demote existing numeric values} {wideIntExpressions} {
+ set a [expr {0xaaaaaaaaaa + 1}]
+ set b 0xaaaaaaaaab
+ list [catch {format %08x $a} msg] $msg [expr {$a == $b}]
+} {1 {integer value too large to represent} 1}
+
# cleanup
catch {unset a}
catch {unset b}