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

Function TestOnlyFilesFS_Open

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

Source from the content-addressed store, hash-verified

19}
20
21func TestOnlyFilesFS_Open(t *testing.T) {
22 var testFile *os.File
23 mockFS := &mockFileSystem{
24 open: func(name string) (http.File, error) {
25 return testFile, nil
26 },
27 }
28 fs := &OnlyFilesFS{FileSystem: mockFS}
29
30 file, err := fs.Open("foo")
31
32 require.NoError(t, err)
33 assert.Equal(t, testFile, file.(neutralizedReaddirFile).File)
34}
35
36func TestOnlyFilesFS_Open_err(t *testing.T) {
37 testError := errors.New("mock")

Callers

nothing calls this directly

Calls 1

OpenMethod · 0.95

Tested by

no test coverage detected