MCPcopy
hub / github.com/restic/restic / TestFSReaderNested

Function TestFSReaderNested

internal/fs/fs_reader_test.go:202–227  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

200}
201
202func TestFSReaderNested(t *testing.T) {
203 data := test.Random(55, 1<<18+588)
204 now := time.Now()
205 filename := "foo/sub/bar"
206
207 tests := createReadDirTest("", "foo")
208 tests = append(tests, createReadDirTest("foo", "sub")...)
209 tests = append(tests, createReadDirTest("foo/sub", "bar")...)
210 tests = append(tests, createFileTest(filename, now, data)...)
211 tests = append(tests, createDirTest("", now)...)
212 tests = append(tests, createDirTest("foo", now)...)
213 tests = append(tests, createDirTest("foo/sub", now)...)
214
215 for _, tst := range tests {
216 fs, err := NewReader(filename, io.NopCloser(bytes.NewReader(data)), ReaderOptions{
217 Mode: 0644,
218 Size: int64(len(data)),
219 ModTime: now,
220 })
221 test.OK(t, err)
222
223 t.Run(tst.name, func(t *testing.T) {
224 tst.f(t, fs)
225 })
226 }
227}
228
229func TestFSReaderDir(t *testing.T) {
230 data := test.Random(55, 1<<18+588)

Callers

nothing calls this directly

Calls 8

RandomFunction · 0.92
OKFunction · 0.92
createReadDirTestFunction · 0.85
createFileTestFunction · 0.85
createDirTestFunction · 0.85
NowMethod · 0.80
RunMethod · 0.80
NewReaderFunction · 0.70

Tested by

no test coverage detected