MCPcopy
hub / github.com/fluid-cloudnative/fluid / TestIsDeprecated

Function TestIsDeprecated

pkg/errors/errors_test.go:31–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29}
30
31func TestIsDeprecated(t *testing.T) {
32
33 testCases := []struct {
34 Name string
35 Err error
36 expect bool
37 }{
38 {
39 Name: "deprecated",
40 Err: NewDeprecated(resource("test"), types.NamespacedName{}),
41 expect: true,
42 },
43 {
44 Name: "no deprecated",
45 Err: fmt.Errorf("test"),
46 expect: false,
47 },
48 }
49
50 err := NewDeprecated(resource("test"), types.NamespacedName{})
51 if err.Details() == nil {
52 t.Errorf("expect error details %v is not nil", err.Details())
53 }
54
55 if len(err.Error()) == 0 {
56 t.Errorf("expect error is not empty, but %v", err.Error())
57 }
58
59 for _, testCase := range testCases {
60 if testCase.expect != IsDeprecated(testCase.Err) {
61 t.Errorf("testCase %s: expected %v ,got %v", testCase.Name, testCase.expect, IsDeprecated(testCase.Err))
62 }
63 }
64}
65
66func TestIsNotSupported(t *testing.T) {
67 testCases := []struct {

Callers

nothing calls this directly

Calls 5

NewDeprecatedFunction · 0.85
resourceFunction · 0.85
IsDeprecatedFunction · 0.85
DetailsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected