mirror of https://github.com/ledisdb/ledisdb.git
Merge pull request #223 from nikolay-turpitko/master
Command names in the ledis.call() should not be case sensetive #218
This commit is contained in:
commit
965c95295a
|
@ -4,6 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
// "fmt"
|
// "fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/siddontang/go/sync2"
|
"github.com/siddontang/go/sync2"
|
||||||
|
@ -107,6 +108,8 @@ func (c *client) perform() {
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
|
c.cmd = strings.ToLower(c.cmd)
|
||||||
|
|
||||||
if len(c.cmd) == 0 {
|
if len(c.cmd) == 0 {
|
||||||
err = ErrEmptyCommand
|
err = ErrEmptyCommand
|
||||||
} else if exeCmd, ok := regCmds[c.cmd]; !ok {
|
} else if exeCmd, ok := regCmds[c.cmd]; !ok {
|
||||||
|
|
|
@ -101,6 +101,10 @@ var testScript4 = `
|
||||||
ledis.call("set", 2, "b")
|
ledis.call("set", 2, "b")
|
||||||
`
|
`
|
||||||
|
|
||||||
|
var testScript5 = `
|
||||||
|
return ledis.call("PING")
|
||||||
|
`
|
||||||
|
|
||||||
func TestLuaCall(t *testing.T) {
|
func TestLuaCall(t *testing.T) {
|
||||||
cfg := config.NewConfigDefault()
|
cfg := config.NewConfigDefault()
|
||||||
cfg.Addr = ":11188"
|
cfg.Addr = ":11188"
|
||||||
|
@ -173,5 +177,15 @@ func TestLuaCall(t *testing.T) {
|
||||||
t.Fatal(string(v))
|
t.Fatal(string(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = app.script.l.DoString(testScript5)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
v = luaReplyToLedisReply(l)
|
||||||
|
if vv := v.(string); vv != "PONG" {
|
||||||
|
t.Fatal(fmt.Sprintf("%v %T", v, v))
|
||||||
|
}
|
||||||
|
|
||||||
luaClient.db = nil
|
luaClient.db = nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue