2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-17 02:25:12 +00:00
restic/internal/fs/stat_test.go
Michael Eischer ff7ef5007e Replace most usages of ioutil with the underlying function
The ioutil functions are deprecated since Go 1.17 and only wrap another
library function. Thus directly call the underlying function.

This commit only mechanically replaces the function calls.
2022-12-02 19:36:43 +01:00

32 lines
573 B
Go

package fs
import (
"os"
"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 := os.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)
}
}