ledisdb/server/cmd_server_test.go

39 lines
625 B
Go
Raw Normal View History

package server
import (
"github.com/siddontang/goredis"
"testing"
)
2015-03-22 03:39:20 +03:00
func TestXSelect(t *testing.T) {
c1 := getTestConn()
defer c1.Close()
c2 := getTestConn()
defer c2.Close()
2015-03-22 03:39:20 +03:00
_, err := c1.Do("XSELECT", "1", "THEN", "SET", "tmp_select_key", "1")
if err != nil {
t.Fatal(err)
}
_, err = goredis.Int(c2.Do("GET", "tmp_select_key"))
if err != goredis.ErrNil {
t.Fatal(err)
}
2015-03-22 03:39:20 +03:00
n, _ := goredis.Int(c2.Do("XSELECT", "1", "THEN", "GET", "tmp_select_key"))
if n != 1 {
t.Fatal(n)
}
n, _ = goredis.Int(c2.Do("GET", "tmp_select_key"))
if n != 1 {
t.Fatal(n)
}
c1.Do("SELECT", 0)
c2.Do("SELECT", 0)
}