MCPcopy
hub / github.com/restic/restic / TestFSReaderDir

Function TestFSReaderDir

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

Source from the content-addressed store, hash-verified

227}
228
229func TestFSReaderDir(t *testing.T) {
230 data := test.Random(55, 1<<18+588)
231 now := time.Now()
232
233 var tests = []struct {
234 name string
235 filename string
236 }{
237 {
238 name: "Lstat-absolute",
239 filename: "/path/to/foobar",
240 },
241 {
242 name: "Lstat-relative",
243 filename: "path/to/foobar",
244 },
245 }
246
247 for _, tst := range tests {
248 t.Run(tst.name, func(t *testing.T) {
249 fs, err := NewReader(tst.filename, io.NopCloser(bytes.NewReader(data)), ReaderOptions{
250 Mode: 0644,
251 Size: int64(len(data)),
252 ModTime: now,
253 })
254 test.OK(t, err)
255 dir := path.Dir(tst.filename)
256 for dir != "/" && dir != "." {
257 fi, err := fs.Lstat(dir)
258 test.OK(t, err)
259
260 checkFileInfo(t, fi, dir, now, os.ModeDir|0755, true)
261
262 dir = path.Dir(dir)
263 }
264 })
265 }
266}
267
268func TestFSReaderMinFileSize(t *testing.T) {
269 var tests = []struct {

Callers

nothing calls this directly

Calls 8

LstatMethod · 0.95
RandomFunction · 0.92
OKFunction · 0.92
checkFileInfoFunction · 0.85
NowMethod · 0.80
RunMethod · 0.80
NewReaderFunction · 0.70
DirMethod · 0.65

Tested by

no test coverage detected