MCPcopy
hub / github.com/restic/restic / createFileTest

Function createFileTest

internal/fs/fs_reader_test.go:91–123  ·  view source on GitHub ↗
(filename string, now time.Time, data []byte)

Source from the content-addressed store, hash-verified

89}
90
91func createFileTest(filename string, now time.Time, data []byte) fsTest {
92 return fsTest{
93 {
94 name: "file/OpenFile",
95 f: func(t *testing.T, fs FS) {
96 verifyFileContentOpenFile(t, fs, filename, data)
97 },
98 },
99 {
100 name: "file/Open-error-not-exist",
101 f: func(t *testing.T, fs FS) {
102 _, err := fs.OpenFile(filename+"/other", O_RDONLY, false)
103 test.Assert(t, errors.Is(err, os.ErrNotExist), "unexpected error, got %v, expected %v", err, os.ErrNotExist)
104 },
105 },
106 {
107 name: "file/Lstat",
108 f: func(t *testing.T, fs FS) {
109 fi, err := fs.Lstat(filename)
110 test.OK(t, err)
111
112 checkFileInfo(t, fi, filename, now, 0644, false)
113 },
114 },
115 {
116 name: "file/Stat",
117 f: func(t *testing.T, fs FS) {
118 fi := fsOpenAndStat(t, fs, filename, true)
119 checkFileInfo(t, fi, filename, now, 0644, false)
120 },
121 },
122 }
123}
124
125func createDirTest(fpath string, now time.Time) fsTest {
126 return fsTest{

Callers 2

TestFSReaderFunction · 0.85
TestFSReaderNestedFunction · 0.85

Calls 7

AssertFunction · 0.92
OKFunction · 0.92
checkFileInfoFunction · 0.85
fsOpenAndStatFunction · 0.85
OpenFileMethod · 0.65
LstatMethod · 0.65

Tested by

no test coverage detected