summaryrefslogtreecommitdiffstats
path: root/tests/get.test
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-16 15:59:40 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-16 15:59:40 (GMT)
commitfe8f0c596ee02b8811d1d2f4d23b8fdbb166a2ed (patch)
treec97e96389c58ac76d16b27fe19ddb3689118e093 /tests/get.test
parent74cee16544d00f49288f1819fb71e1c5c74ce5ad (diff)
parent29606e4a7b43adb9f923fb5781d3b9a93d9ba1c8 (diff)
downloadtcl-gahr_ticket_e6f27aa56f.zip
tcl-gahr_ticket_e6f27aa56f.tar.gz
tcl-gahr_ticket_e6f27aa56f.tar.bz2
Diffstat (limited to 'tests/get.test')
-rw-r--r--tests/get.test22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/get.test b/tests/get.test
index d51ec6d..7aa06c1 100644
--- a/tests/get.test
+++ b/tests/get.test
@@ -19,9 +19,10 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
catch [list package require -exact Tcltest [info patchlevel]]
testConstraint testgetint [llength [info commands testgetint]]
+testConstraint testdoubleobj [llength [info commands testdoubleobj]]
testConstraint longIs32bit [expr {int(0x80000000) < 0}]
testConstraint longIs64bit [expr {int(0x8000000000000000) < 0}]
-
+
test get-1.1 {Tcl_GetInt procedure} testgetint {
testgetint 44 { 22}
} {66}
@@ -95,7 +96,24 @@ test get-3.2 {Tcl_GetDouble(FromObj), bad numbers} {
}
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"}}
-
+# Bug 7114ac6141
+test get-3.3 {tcl_GetInt with iffy numbers} testgetint {
+ lmap x {0 " 0" "0 " " 0 " " 0xa " " 010 " " 0o10 " " 0b10 "} {
+ catch {testgetint 44 $x} x
+ set x
+ }
+} {44 44 44 44 54 52 52 46}
+test get-3.4 {Tcl_GetDouble with iffy numbers} testdoubleobj {
+ lmap x {0 0.0 " .0" ".0 " " 0e0 " "09" "- 0" "-0" "0o12" "0b10"} {
+ catch {testdoubleobj set 1 $x} x
+ set x
+ }
+} {0.0 0.0 0.0 0.0 0.0 {expected floating-point number but got "09" (looks like invalid octal number)} {expected floating-point number but got "- 0"} 0.0 10.0 2.0}
+
# cleanup
::tcltest::cleanupTests
return
+
+# Local Variables:
+# mode: tcl
+# End: