mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-05 08:46:56 +08:00
chore: use t.Errorf(...) instead of t.Error(fmt.Sprintf(...))
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/hdt3213/godis/lib/utils"
|
||||
"github.com/hdt3213/godis/redis/protocol"
|
||||
"github.com/hdt3213/godis/redis/protocol/asserts"
|
||||
@@ -37,11 +36,11 @@ func TestSAdd(t *testing.T) {
|
||||
result = testDB.Exec(nil, utils.ToCmdLine("SMembers", key))
|
||||
multiBulk, ok := result.(*protocol.MultiBulkReply)
|
||||
if !ok {
|
||||
t.Error(fmt.Sprintf("expected bulk protocol, actually %s", result.ToBytes()))
|
||||
t.Errorf("expected bulk protocol, actually %s", result.ToBytes())
|
||||
return
|
||||
}
|
||||
if len(multiBulk.Args) != size {
|
||||
t.Error(fmt.Sprintf("expected %d elements, actually %d", size, len(multiBulk.Args)))
|
||||
t.Errorf("expected %d elements, actually %d", size, len(multiBulk.Args))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -84,7 +83,7 @@ func TestSPop(t *testing.T) {
|
||||
resultSpop := testDB.Exec(nil, utils.ToCmdLine("spop", key, strconv.FormatInt(int64(count), 10)))
|
||||
multiBulk, ok := resultSpop.(*protocol.MultiBulkReply)
|
||||
if !ok {
|
||||
t.Error(fmt.Sprintf("expected bulk protocol, actually %s", resultSpop.ToBytes()))
|
||||
t.Errorf("expected bulk protocol, actually %s", resultSpop.ToBytes())
|
||||
return
|
||||
}
|
||||
removedSize := len(multiBulk.Args)
|
||||
@@ -220,7 +219,7 @@ func TestSRandMember(t *testing.T) {
|
||||
result := testDB.Exec(nil, utils.ToCmdLine("SRandMember", key))
|
||||
br, ok := result.(*protocol.BulkReply)
|
||||
if !ok && len(br.Arg) > 0 {
|
||||
t.Error(fmt.Sprintf("expected bulk protocol, actually %s", result.ToBytes()))
|
||||
t.Errorf("expected bulk protocol, actually %s", result.ToBytes())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -228,7 +227,7 @@ func TestSRandMember(t *testing.T) {
|
||||
asserts.AssertMultiBulkReplySize(t, result, 10)
|
||||
multiBulk, ok := result.(*protocol.MultiBulkReply)
|
||||
if !ok {
|
||||
t.Error(fmt.Sprintf("expected bulk protocol, actually %s", result.ToBytes()))
|
||||
t.Errorf("expected bulk protocol, actually %s", result.ToBytes())
|
||||
return
|
||||
}
|
||||
m := make(map[string]struct{})
|
||||
@@ -236,7 +235,7 @@ func TestSRandMember(t *testing.T) {
|
||||
m[string(arg)] = struct{}{}
|
||||
}
|
||||
if len(m) != 10 {
|
||||
t.Error(fmt.Sprintf("expected 10 members, actually %d", len(m)))
|
||||
t.Errorf("expected 10 members, actually %d", len(m))
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user