summaryrefslogtreecommitdiff
path: root/tests/support/util.tcl
diff options
context:
space:
mode:
authorHuang Zhw <huang_zhw@126.com>2021-09-24 21:58:38 +0800
committerGitHub <noreply@github.com>2021-09-24 16:58:38 +0300
commitbdecbd30df83b838bce1cb06743611abc129b208 (patch)
tree438120c24d74abde2ef86a1d9cde9b569355b558 /tests/support/util.tcl
parentf0fab99d6fd7b4310f03a2c84b465fae98d31bc0 (diff)
downloadredis-bdecbd30df83b838bce1cb06743611abc129b208.tar.gz
Fix test randstring, compare string and int is wrong. (#9544)
This will cause the generated string containing "\". Fixes a broken change in #8687
Diffstat (limited to 'tests/support/util.tcl')
-rw-r--r--tests/support/util.tcl5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/support/util.tcl b/tests/support/util.tcl
index 67551b041..8f093c33e 100644
--- a/tests/support/util.tcl
+++ b/tests/support/util.tcl
@@ -12,9 +12,10 @@ proc randstring {min max {type binary}} {
set maxval 52
}
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 {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
incr len -1
}