diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2013-10-22 18:58:49 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2013-10-22 18:58:49 (GMT) |
commit | 3840fcc4dd1c28595fc927287edcd057b0643420 (patch) | |
tree | 3fb5ddac3f3c1cb95aa48679ac4d28da1b1d1652 /tests/scan.test | |
parent | 545698c7c06b1e3d1956d77508ecaf251163fb22 (diff) | |
parent | 1c8937d85be2f327d881c29e203c46df34b9da08 (diff) | |
download | tcl-3840fcc4dd1c28595fc927287edcd057b0643420.zip tcl-3840fcc4dd1c28595fc927287edcd057b0643420.tar.gz tcl-3840fcc4dd1c28595fc927287edcd057b0643420.tar.bz2 |
[3556215]: Made [scan] match [format] better in what it accepts as a format
string, by allowing uppercase %X, %E and %G.
Diffstat (limited to 'tests/scan.test')
-rw-r--r-- | tests/scan.test | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/scan.test b/tests/scan.test index ea0c500..b57b641 100644 --- a/tests/scan.test +++ b/tests/scan.test @@ -375,6 +375,12 @@ test scan-4.48 {Tcl_ScanObjCmd, float scanning} { test scan-4.49 {Tcl_ScanObjCmd, float scanning} { list [scan {.1 0.2 3.} {%e %f %g} x y z] $x $y $z } {3 0.1 0.2 3.0} +test scan-4.49-uc-1 {Tcl_ScanObjCmd, float scanning} { + list [scan {0.5*0.75} {%E%c%G} x y z] $x $y $z +} {3 0.5 42 0.75} +test scan-4.49-uc-2 {Tcl_ScanObjCmd, float scanning} { + list [scan {5e-1*75E-2} {%E%c%G} x y z] $x $y $z +} {3 0.5 42 0.75} test scan-4.50 {Tcl_ScanObjCmd, float scanning} { list [scan {1234567890a} %f x] $x } {1 1234567890.0} @@ -450,6 +456,9 @@ test scan-4.63 {scanning of large and negative hex integers} { list [scan $scanstring {%x %x %x} a b c] \ [expr { $a == -1 }] [expr { $b == $MIN_INT }] [expr { $c == $MAX_INT }] } {3 1 1 1} +test scan-4.64 {scanning of hex with %X} { + scan "123 abc f78" %X%X%X +} {291 2748 3960} test scan-5.1 {integer scanning} -setup { set a {}; set b {}; set c {}; set d {} @@ -626,14 +635,14 @@ test scan-8.4 {error conditions} -returnCodes error -body { scan a %O x } -result {bad scan conversion character "O"} test scan-8.5 {error conditions} -returnCodes error -body { - scan a %X x -} -result {bad scan conversion character "X"} + scan a %B x +} -result {bad scan conversion character "B"} test scan-8.6 {error conditions} -returnCodes error -body { scan a %F x } -result {bad scan conversion character "F"} test scan-8.7 {error conditions} -returnCodes error -body { - scan a %E x -} -result {bad scan conversion character "E"} + scan a %p x +} -result {bad scan conversion character "p"} test scan-8.8 {error conditions} -returnCodes error -body { scan a "%d %d" a } -result {different numbers of variable names and field specifiers} |