MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / TestStrlen

Function TestStrlen

IceFireDB-Redis-Proxy/test/cmd_string_test.go:877–920  ·  view source on GitHub ↗

* func TestGetdel(t *testing.T) { server.Clear() c, err := proto.Dial(server.Addr()) ok(t, err) defer c.Close() s := server.Direct() // Missing key { mustNil(t, c, "GETDEL", "foo") } // Existing key { s.Set("foo", "bar") mustDo(t, c, "GETDEL", "foo", proto.Str

(t *testing.T)

Source from the content-addressed store, hash-verified

875 }
876*/
877func TestStrlen(t *testing.T) {
878 server.Clear()
879 c, err := proto.Dial(server.Addr())
880 ok(t, err)
881 defer c.Close()
882 s := server.Direct()
883
884 // Existing key
885 {
886 s.Set("foo", "bar!")
887 mustDo(t, c,
888 "STRLEN", "foo",
889 proto.Int(4),
890 )
891 }
892
893 // New key
894 {
895 must0(t, c,
896 "STRLEN", "nosuch",
897 )
898 }
899
900 // Wrong type of existing key
901 {
902 s.HSet("wrong", "aap", "noot")
903 mustDo(t, c,
904 "STRLEN", "wrong",
905 proto.Error(msgWrongType),
906 )
907 }
908
909 // Wrong usage
910 {
911 mustDo(t, c,
912 "STRLEN",
913 proto.Error(errWrongNumber("strlen")),
914 )
915 mustDo(t, c,
916 "STRLEN", "spurious", "arguments",
917 proto.Error(errWrongNumber("strlen")),
918 )
919 }
920}
921
922func TestAppend(t *testing.T) {
923 server.Clear()

Callers

nothing calls this directly

Calls 12

ClearFunction · 0.92
DialFunction · 0.92
AddrFunction · 0.92
DirectFunction · 0.92
IntFunction · 0.92
ErrorFunction · 0.92
SetMethod · 0.80
okFunction · 0.70
mustDoFunction · 0.70
must0Function · 0.70
errWrongNumberFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected