Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
b1d9c91c
Commit
b1d9c91c
authored
Mar 17, 2010
by
antirez
Browse files
More Hash tests
parent
164ee595
Changes
1
Show whitespace changes
Inline
Side-by-side
test-redis.tcl
View file @
b1d9c91c
...
...
@@ -1580,6 +1580,43 @@ proc main {server port} {
set _ $err
} {}
test {HSET return value. Update or insert?} {
set rv {}
set k [lindex [array names smallhash *] 0]
lappend rv [$r hset smallhash $k newval]
lappend rv [$r hset smallhash __foobar123__ newval]
set k [lindex [array names bighash *] 0]
lappend rv [$r hset bighash $k newval]
lappend rv [$r hset bighash __foobar123__ newval]
lappend rv [$r hdel smallhash __foobar123__]
lappend rv [$r hdel bighash __foobar123__]
set _ $rv
} {0 1 0 1 1 1}
test {HGET against non existing key} {
set rv {}
lappend rv [$r hget smallhash __123123123__]
lappend rv [$r hget bighash __123123123__]
set _ $rv
} {{} {}}
test {HKEYS - small hash} {
lsort [$r hkeys smallhash]
} [lsort [array names smallhash *]]
test {HKEYS - big hash} {
lsort [$r hkeys bighash]
} [lsort [array names bighash *]]
# TODO:
# Propoted to hash table on big payload?
# HVALS
# HGETALL
# HDEL
# HDEL return value
# Randomized test, small and big
# .rdb / AOF consistency test should include hashes
test {EXPIRE - don't set timeouts multiple times} {
$r set x foobar
set v1 [$r expire x 5]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment