OpenAtomFoundation / pikiwidb

a high-performance, large-capacity, multi-tenant, data-persistent, strong data consistency based on raft, Redis-compatible elastic KV data storage system based on RocksDB
BSD 3-Clause "New" or "Revised" License
194 stars 63 forks source link

test: add redis tcl test #278

Closed Mixficsol closed 4 months ago

Mixficsol commented 4 months ago

快速入门 TCL

以这段代码举例, r 代表 Redis 执行,所以下面这段代码意思是先执行 Del novar 命令,然后再执行 setnx novar foobared 命令检查返回值是不是 1, 然后执行 get novar 检查返回值是不是 foobared,这就是一个最简单的 TCL 样例

    test "SETNX target key missing" {
        r del novar
        assert_equal 1 [r setnx novar foobared]
        assert_equal "foobared" [r get novar]
    }

test_helpter.tcl 文件下注释了大部分的测试,如果有需要可以自行解开(因为现在大部分测试都跑不过,所以我都先注释掉了)

set ::all_tests {
   # unit/printver
   # unit/basic
   # unit/scan
   # unit/multi
   # unit/quit
   # unit/type/list
   # unit/pubsub
   # unit/slowlog
   # unit/maxmemory
   # unit/bitops
   # unit/hyperloglog
   # unit/type
   # unit/acl
   # unit/type/list-2
    # unit/type/list-3
    # unit/type/set
    # unit/type/zset
    # unit/type/string
    unit/type/hash
    # unit/expire
    # unit/protocol
    # unit/other
    # unit/auth
    # unit/sort
    # unit/aofrw
    # unit/scripting
    # unit/introspection
    # unit/limits
    # unit/obuf-limits
    # unit/dump
    # unit/memefficiency
    # unit/command
    # unit/tcl/replication
    # unit/tcl/replication-2
    # unit/tcl/replication-3
    # unit/tcl/replication-4
    # unit/tcl/replication-psync
    # unit/tcl/aof
    # unit/tcl/rdb
    # unit/tcl/convert-zipmap-hash-on-load
}