mirror of
https://github.com/restic/restic.git
synced 2024-08-29 05:06:02 +02:00
![Alexander Neumann](/assets/img/avatar_default.png)
This adds two implementations of the new `FS` interface: One for the local file system (`Local`) and one for a single file read from an `io.Reader` (`Reader`).
32 lines
584 B
Go
32 lines
584 B
Go
package fs
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
restictest "github.com/restic/restic/internal/test"
|
|
)
|
|
|
|
func TestExtendedStat(t *testing.T) {
|
|
tempdir, cleanup := restictest.TempDir(t)
|
|
defer cleanup()
|
|
|
|
filename := filepath.Join(tempdir, "file")
|
|
err := ioutil.WriteFile(filename, []byte("foobar"), 0640)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
fi, err := Lstat(filename)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
extFI := ExtendedStat(fi)
|
|
|
|
if !extFI.ModTime.Equal(fi.ModTime()) {
|
|
t.Errorf("extFI.ModTime does not match, want %v, got %v", fi.ModTime(), extFI.ModTime)
|
|
}
|
|
}
|