add shell test #2

Merged
zeekling merged 1 commits from shell_test into master 2022-02-14 15:20:28 +00:00
3 changed files with 31 additions and 0 deletions

12
test/commands/zset.txt Normal file
View File

@ -0,0 +1,12 @@
del books_zset
zadd books_zset 9.0 "think in java"
zadd books_zset 8.9 "java concurrency"
zadd books_zset 8.6 "java cookbook"
zrange books_zset 0 -1
zrevrange books_zset 0 -1
zcard books_zset
zscore books_zset "java concurrency"
zrank books_zset "java concurrency"
zrangebyscore books_zset -inf 8.91 withscores
zrem books_zset "java concurrency"
zrange books_zset 0 -1

13
test/exec_redis.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
function exec() {
ip="$1"
port="$2"
file="$3"
while read line
do
echo "> $line"
echo $line | redis-cli -h "$ip" -p "$port"
done < $file
}

6
test/zset.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
source ./exec_redis.sh
exec "127.0.0.1" "6379" commands/zset.txt