summaryrefslogtreecommitdiffstats
path: root/tests/format.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2003-05-14 22:45:10 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2003-05-14 22:45:10 (GMT)
commit3863b1c0eac186a8e9cb66952c457082ef00ac8d (patch)
treebdea045bc5f7963a4fb6247c17f8e39956e05c61 /tests/format.test
parent5cd21052537a2597271ccdca2ceffe007a74e0b3 (diff)
downloadtcl-3863b1c0eac186a8e9cb66952c457082ef00ac8d.zip
tcl-3863b1c0eac186a8e9cb66952c457082ef00ac8d.tar.gz
tcl-3863b1c0eac186a8e9cb66952c457082ef00ac8d.tar.bz2
Stopped [format] from demoting wides to ints too easily. [Bug 699060]
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 7c383ee..1e57bd4 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.14 2003/03/27 13:19:15 dkf Exp $
+# RCS: @(#) $Id: format.test,v 1.15 2003/05/14 22:45:12 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -505,6 +505,29 @@ test format-17.4 {testing %l with non-integer} {
format %lf 1
} 1.000000
+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} {
+ 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}