MCPcopy Index your code
hub / github.com/nutsdb/nutsdb / TestIsKeyEmpty

Function TestIsKeyEmpty

errors_test.go:40–65  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

38}
39
40func TestIsKeyEmpty(t *testing.T) {
41 type args struct {
42 err error
43 }
44 tests := []struct {
45 name string
46 args args
47 want bool
48 }{
49 {"case1", args{fmt.Errorf("foo error")}, false},
50 {"case2", args{fmt.Errorf("foo error,%w", errors.New("sourceErr"))}, false},
51 {"case3", args{fmt.Errorf("foo error,%w", ErrKeyEmpty)}, true},
52 {"case4_errors.Wrap", args{errors.Wrap(ErrKeyEmpty, "foo Err")}, true},
53 {"case5_errors.Wrapf", args{errors.Wrapf(ErrKeyEmpty, "foo Err %s", ErrKeyEmpty.Error())}, true},
54 {"case6_errors.rawError", args{ErrKeyEmpty}, true},
55 {"case6_errors.keynotfoundErr", args{ErrKeyNotFound}, false},
56 // {"case5", args{errors.Wrap())}, true},
57 }
58 for _, tt := range tests {
59 t.Run(tt.name, func(t *testing.T) {
60 if got := IsKeyEmpty(tt.args.err); got != tt.want {
61 t.Errorf("IsKeyEmpty() = %v, want %v", got, tt.want)
62 }
63 })
64 }
65}
66
67func TestIsBucketNotFound(t *testing.T) {
68 ts := []struct {

Callers

nothing calls this directly

Calls 3

IsKeyEmptyFunction · 0.85
RunMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected