MCPcopy
hub / github.com/gin-gonic/gin / TestOnlyFilesFS_Open_err

Function TestOnlyFilesFS_Open_err

fs_test.go:36–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestOnlyFilesFS_Open_err(t *testing.T) {
37 testError := errors.New("mock")
38 mockFS := &mockFileSystem{
39 open: func(_ string) (http.File, error) {
40 return nil, testError
41 },
42 }
43 fs := &OnlyFilesFS{FileSystem: mockFS}
44
45 file, err := fs.Open("foo")
46
47 require.ErrorIs(t, err, testError)
48 assert.Nil(t, file)
49}
50
51func Test_neuteredReaddirFile_Readdir(t *testing.T) {
52 n := neutralizedReaddirFile{}

Callers

nothing calls this directly

Calls 1

OpenMethod · 0.95

Tested by

no test coverage detected