summaryrefslogtreecommitdiffstats
path: root/tests/scan.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scan.test')
-rw-r--r--tests/scan.test47
1 files changed, 26 insertions, 21 deletions
diff --git a/tests/scan.test b/tests/scan.test
index 97ad5eb..109746f 100644
--- a/tests/scan.test
+++ b/tests/scan.test
@@ -98,10 +98,10 @@ test scan-3.13 {ValidateFormat} {
test scan-4.1 {Tcl_ScanObjCmd, argument checks} {
list [catch {scan} msg] $msg
-} {1 {wrong # args: should be "scan string format ?varName ...?"}}
+} {1 {wrong # args: should be "scan string format ?varName varName ...?"}}
test scan-4.2 {Tcl_ScanObjCmd, argument checks} {
list [catch {scan string} msg] $msg
-} {1 {wrong # args: should be "scan string format ?varName ...?"}}
+} {1 {wrong # args: should be "scan string format ?varName varName ...?"}}
test scan-4.3 {Tcl_ScanObjCmd, argument checks} {
# degenerate case, before changed from 8.2 to 8.3
list [catch {scan string format} msg] $msg
@@ -246,14 +246,10 @@ test scan-4.40.2 {Tcl_ScanObjCmd, base-16 integer scanning} {
catch {unset x}
list [scan {xF} {%x} x] [info exists x]
} {0 0}
-test scan-4.40.3 {Tcl_ScanObjCmd, base-2 integer scanning} {
- set x {}
- list [scan {1001 0b101 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} {%b %b %llb} x y z] $x $y $z
-} {3 9 5 340282366920938463463374607431768211456}
test scan-4.41 {Tcl_ScanObjCmd, base-unknown integer scanning} {
set x {}
- list [scan {10 010 0x10 0b10} {%i%i%i%i} x y z t] $x $y $z $t
-} {4 10 8 16 0}
+ list [scan {10 010 0x10} {%i%i%i} x y z] $x $y $z
+} {3 10 8 16}
test scan-4.42 {Tcl_ScanObjCmd, base-unknown integer scanning} {
set x {}
list [scan {10 010 0X10} {%i%i%i} x y z] $x $y $z
@@ -284,6 +280,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}
@@ -328,7 +330,7 @@ test scan-4.60 {Tcl_ScanObjCmd, set errors} {
$msg $x $y]
unset z
set result
-} {1 {can't set "z": variable is array} abc ghi}
+} {1 {couldn't set variable "z"} abc ghi}
test scan-4.61 {Tcl_ScanObjCmd, set errors} {
set x {}
catch {unset y}; array set y {}
@@ -338,7 +340,7 @@ test scan-4.61 {Tcl_ScanObjCmd, set errors} {
unset y
unset z
set result
-} {1 {can't set "z": variable is array} abc}
+} {1 {couldn't set variable "z"couldn't set variable "y"} abc}
# procedure that returns the range of integers
@@ -363,6 +365,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}
# clean up from last two tests
@@ -485,7 +490,7 @@ test scan-7.3 {string and character scanning} {
list [scan "123456 test " "%*c%*s %s %s %s" a b c] $a $b $c
} {1 test {} {}}
test scan-7.4 {string and character scanning} {
- set a {}; set b {}; set c {}; set d
+ set a {}; set b {}; set c {}; set d {}
list [scan "ababcd01234 f 123450" {%4[abcd] %4[abcd] %[^abcdef] %[^0]} a b c d] $a $b $c $d
} {4 abab cd {01234 } {f 12345}}
test scan-7.5 {string and character scanning} {
@@ -511,7 +516,7 @@ test scan-8.1 {error conditions} {
test scan-8.2 {error conditions} {
catch {scan a} msg
set msg
-} {wrong # args: should be "scan string format ?varName ...?"}
+} {wrong # args: should be "scan string format ?varName varName ...?"}
test scan-8.3 {error conditions} {
list [catch {scan a %D x} msg] $msg
} {1 {bad scan conversion character "D"}}
@@ -519,14 +524,14 @@ test scan-8.4 {error conditions} {
list [catch {scan a %O x} msg] $msg
} {1 {bad scan conversion character "O"}}
test scan-8.5 {error conditions} {
- list [catch {scan a %X x} msg] $msg
-} {1 {bad scan conversion character "X"}}
+ list [catch {scan a %B x} msg] $msg
+} {1 {bad scan conversion character "B"}}
test scan-8.6 {error conditions} {
list [catch {scan a %F x} msg] $msg
} {1 {bad scan conversion character "F"}}
test scan-8.7 {error conditions} {
- list [catch {scan a %E x} msg] $msg
-} {1 {bad scan conversion character "E"}}
+ list [catch {scan a %p x} msg] $msg
+} {1 {bad scan conversion character "p"}}
test scan-8.8 {error conditions} {
list [catch {scan a "%d %d" a} msg] $msg
} {1 {different numbers of variable names and field specifiers}}
@@ -545,27 +550,27 @@ test scan-8.12 {error conditions} {
catch {unset a}
set a(0) 44
list [catch {scan 44 %d a} msg] $msg
-} {1 {can't set "a": variable is array}}
+} {1 {couldn't set variable "a"}}
test scan-8.13 {error conditions} {
catch {unset a}
set a(0) 44
list [catch {scan 44 %c a} msg] $msg
-} {1 {can't set "a": variable is array}}
+} {1 {couldn't set variable "a"}}
test scan-8.14 {error conditions} {
catch {unset a}
set a(0) 44
list [catch {scan 44 %s a} msg] $msg
-} {1 {can't set "a": variable is array}}
+} {1 {couldn't set variable "a"}}
test scan-8.15 {error conditions} {
catch {unset a}
set a(0) 44
list [catch {scan 44 %f a} msg] $msg
-} {1 {can't set "a": variable is array}}
+} {1 {couldn't set variable "a"}}
test scan-8.16 {error conditions} {
catch {unset a}
set a(0) 44
list [catch {scan 44 %f a} msg] $msg
-} {1 {can't set "a": variable is array}}
+} {1 {couldn't set variable "a"}}
catch {unset a}
test scan-8.17 {error conditions} {
list [catch {scan 44 %2c a} msg] $msg