diff options
author | Steve Bennett <steveb@workware.net.au> | 2013-08-28 08:10:48 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2013-08-28 08:28:30 +1000 |
commit | 38b51b2dff7511e873b205c5f9fd7604fff3387c (patch) | |
tree | 59bc86c9a2db4c73caff05aea6cc932a74c5a797 | |
parent | 9a5f6d477a47592f3e835b3e61005e1562faf7d7 (diff) | |
download | jimtcl-38b51b2dff7511e873b205c5f9fd7604fff3387c.zip jimtcl-38b51b2dff7511e873b205c5f9fd7604fff3387c.tar.gz jimtcl-38b51b2dff7511e873b205c5f9fd7604fff3387c.tar.bz2 |
Re-add missing tests from 45e938f7
Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r-- | tests/binary.test | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/binary.test b/tests/binary.test index d7a427b..8229390 100644 --- a/tests/binary.test +++ b/tests/binary.test @@ -641,6 +641,13 @@ test binary-20.9 {Tcl_BinaryObjCmd: scan} -setup { list [binary scan abc a arg1(a)] $arg1(a) } -result {1 a} +# As soon as a conversion runs out of bytes, scan should stop +test binary-20.10 {Tcl_BinaryObjCmd: scan, too few bytes} -setup { + unset -nocomplain arg1 arg2 +} -body { + list [binary scan abc a5a2 arg1 arg2] [info exists arg1] [info exists arg2] +} -result {0 0 0} + test binary-21.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body { binary scan abc A } -result {not enough arguments for all format specifiers} @@ -752,6 +759,14 @@ test binary-22.11 {Tcl_BinaryObjCmd: scan} -setup { list [binary scan \x07\x87\x05 b5b* arg1 arg2] $arg1 $arg2 } -result {2 11100 1110000110100000} +# As soon as a conversion runs out of bytes, scan should stop +test binary-20.12 {Tcl_BinaryObjCmd: scan, too few bytes} { + unset -nocomplain arg1 arg2 + set arg1 foo + set arg2 bar + list [binary scan \x52 b14b8 arg1 arg2] $arg1 $arg2 +} {0 foo bar} + test binary-23.1 {Tcl_BinaryObjCmd: scan} -returnCodes error -body { binary scan abc B } -result {not enough arguments for all format specifiers} |