(t *testing.T)
| 38 | } |
| 39 | |
| 40 | func 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 | |
| 67 | func TestIsBucketNotFound(t *testing.T) { |
| 68 | ts := []struct { |
nothing calls this directly
no test coverage detected