MCPcopy Create free account
hub / github.com/gogs/gogs / TestIsNotFound

Function TestIsNotFound

internal/errutil/errutil_test.go:22–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20}
21
22func TestIsNotFound(t *testing.T) {
23 tests := []struct {
24 name string
25 err error
26 expVal bool
27 }{
28 {
29 name: "error does not implement NotFound",
30 err: errors.New("a simple error"),
31 expVal: false,
32 },
33 {
34 name: "error implements NotFound but not a not found",
35 err: notFoundError{val: false},
36 expVal: false,
37 },
38 {
39 name: "error implements NotFound",
40 err: notFoundError{val: true},
41 expVal: true,
42 },
43 }
44 for _, test := range tests {
45 t.Run(test.name, func(t *testing.T) {
46 assert.Equal(t, test.expVal, IsNotFound(test.err))
47 })
48 }
49}

Callers

nothing calls this directly

Calls 1

IsNotFoundFunction · 0.85

Tested by

no test coverage detected