mirror of https://mirror.osredm.com/root/redis.git
Fix test randstring, compare string and int is wrong. (#9544)
This will cause the generated string containing "\". Fixes a broken change in #8687
This commit is contained in:
parent
f0fab99d6f
commit
bdecbd30df
|
@ -12,9 +12,10 @@ proc randstring {min max {type binary}} {
|
||||||
set maxval 52
|
set maxval 52
|
||||||
}
|
}
|
||||||
while {$len} {
|
while {$len} {
|
||||||
set rr [format "%c" [expr {$minval+int(rand()*($maxval-$minval+1))}]]
|
set num [expr {$minval+int(rand()*($maxval-$minval+1))}]
|
||||||
|
set rr [format "%c" $num]
|
||||||
if {$type eq {simplealpha} && ![string is alnum $rr]} {continue}
|
if {$type eq {simplealpha} && ![string is alnum $rr]} {continue}
|
||||||
if {$type eq {alpha} && $rr eq 92} {continue} ;# avoid putting '\' char in the string, it can mess up TCL processing
|
if {$type eq {alpha} && $num eq 92} {continue} ;# avoid putting '\' char in the string, it can mess up TCL processing
|
||||||
append output $rr
|
append output $rr
|
||||||
incr len -1
|
incr len -1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue