summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorgriffin <briang42@easystreet.net>2020-05-31 00:37:01 (GMT)
committergriffin <briang42@easystreet.net>2020-05-31 00:37:01 (GMT)
commitf857db0e8e5938c6ab7163cf16e7c729eeb7cb99 (patch)
tree299d2f0498ec04847b91d62466d846d25e42367f /tests
parent0f48821995b22b0819c4047b51ef2cd23897e125 (diff)
parentea25a2d32d5f1c090e0f6a0a02950ed621be8efe (diff)
downloadtcl-f857db0e8e5938c6ab7163cf16e7c729eeb7cb99.zip
tcl-f857db0e8e5938c6ab7163cf16e7c729eeb7cb99.tar.gz
tcl-f857db0e8e5938c6ab7163cf16e7c729eeb7cb99.tar.bz2
tip-551 implementation.
Diffstat (limited to 'tests')
-rw-r--r--tests/get.test6
-rw-r--r--tests/scan.test10
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/get.test b/tests/get.test
index 997906a..ca6b0ce 100644
--- a/tests/get.test
+++ b/tests/get.test
@@ -109,6 +109,12 @@ test get-3.4 {Tcl_GetDouble with iffy numbers} testdoubleobj {
set x
}
} {0.0 0.0 0.0 0.0 0.0 9.0 {expected floating-point number but got "- 0"} 0.0 10.0 2.0}
+test get-3.5 {tcl_GetInt with numeric whitespace (i.e. '_')} testgetint {
+ lmap x {0_0 " 1_0" "0_2 " " 3_3 " 14__23__32___4 " 0x_a " " 0_07 " " 0o_1_0 " " 0_b1_0 " _33 42_ 0_x15 0_o17 0_d19 } {
+ catch {testgetint $x} x
+ set x
+ }
+} {0 10 2 33 1423324 10 7 8 {expected integer but got " 0_b1_0 "} {expected integer but got "_33"} {expected integer but got "42_"} {expected integer but got "0_x15"} {expected integer but got "0_o17"} {expected integer but got "0_d19"}}
# cleanup
::tcltest::cleanupTests
diff --git a/tests/scan.test b/tests/scan.test
index b488f68..eaeaa49 100644
--- a/tests/scan.test
+++ b/tests/scan.test
@@ -555,6 +555,11 @@ test scan-5.19 {bigint scanning invalid} -setup {
list [scan "207698809136909011942886895" \
%llu a] $a
} -result {1 207698809136909011942886895}
+test scan-5.20 {ignore digit separators} -setup {
+ set a {}; set b {}; set c {};
+} -body {
+ list [scan "10_23_45" %d_%d_%d a b c] $a $b $c
+} -result {3 10 23 45}
test scan-6.1 {floating-point scanning} -setup {
set a {}; set b {}; set c {}; set d {}
@@ -600,6 +605,11 @@ test scan-6.8 {floating-point scanning} -setup {
} -body {
list [scan "4.6 5.2" "%f %f %f %f" a b c d] $a $b $c $d
} -result {2 4.6 5.2 {} {}}
+test scan-6.8 {disallow diget separator in floating-point} -setup {
+ set a {}; set b {}; set c {};
+} -body {
+ list [scan "3.14_2.35_98.6" %f_%f_%f a b c ] $a $b $c
+} -result {3 3.14 2.35 98.6}
test scan-7.1 {string and character scanning} -setup {
set a {}; set b {}; set c {}; set d {}