summaryrefslogtreecommitdiffstats
path: root/tests/get.test
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-11-19 02:34:49 (GMT)
committerhobbs <hobbs>2002-11-19 02:34:49 (GMT)
commitada87b51edc6c26dcb7261164f7092a397ba120c (patch)
tree504abe4bc769d428863271620704ff919b9629b9 /tests/get.test
parente5e99a4fbc43c79c182147cfa5b3f560000ac103 (diff)
downloadtcl-ada87b51edc6c26dcb7261164f7092a397ba120c.zip
tcl-ada87b51edc6c26dcb7261164f7092a397ba120c.tar.gz
tcl-ada87b51edc6c26dcb7261164f7092a397ba120c.tar.bz2
* generic/tclUtil.c (SetEndOffsetFromAny): handle integer offset
after the "end-" prefix. * generic/get.test: * generic/string.test: * generic/tclObj.c (SetIntFromAny, SetWideIntFromAny): * generic/tclGet.c (TclGetLong, Tcl_GetInt): simplify sign handling before calling strtoul(l). [Bug #634856]
Diffstat (limited to 'tests/get.test')
-rw-r--r--tests/get.test20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/get.test b/tests/get.test
index 0d9bea8..4c3f679 100644
--- a/tests/get.test
+++ b/tests/get.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: get.test,v 1.7 2002/02/15 23:42:12 kennykb Exp $
+# RCS: @(#) $Id: get.test,v 1.8 2002/11/19 02:34:50 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -94,6 +94,24 @@ test get-2.4 {Tcl_GetInt procedure} {nonPortable} {
list [catch {format %g .000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001} msg] $msg $errorCode
} {1 {floating-point value too small to represent} {ARITH UNDERFLOW {floating-point value too small to represent}}}
+test get-3.1 {Tcl_GetInt(FromObj), bad numbers} {
+ # SF bug #634856
+ set result ""
+ set numbers [list 1 +1 ++1 +-1 -+1 -1 --1 "- +1" "+12345678987654321" "++12345678987654321"]
+ foreach num $numbers {
+ lappend result [catch {format %ld $num} msg] $msg
+ }
+ set result
+} {0 1 0 1 1 {expected integer but got "++1"} 1 {expected integer but got "+-1"} 1 {expected integer but got "-+1"} 0 -1 1 {expected integer but got "--1"} 1 {expected integer but got "- +1"} 0 12345678987654321 1 {expected integer but got "++12345678987654321"}}
+test get-3.2 {Tcl_GetDouble(FromObj), bad numbers} {
+ set result ""
+ set numbers [list 1.0 +1.0 ++1.0 +-1.0 -+1.0 -1.0 --1.0 "- +1.0"]
+ foreach num $numbers {
+ lappend result [catch {format %g $num} msg] $msg
+ }
+ set result
+} {0 1 0 1 1 {expected floating-point number but got "++1.0"} 1 {expected floating-point number but got "+-1.0"} 1 {expected floating-point number but got "-+1.0"} 0 -1 1 {expected floating-point number but got "--1.0"} 1 {expected floating-point number but got "- +1.0"}}
+
# cleanup
::tcltest::cleanupTests
return