1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-01-21 06:48:35 +00:00
restic/internal/fs/freadlink_test.go

25 lines
475 B
Go
Raw Normal View History

//go:build linux || windows || darwin
// +build linux windows darwin
package fs
import (
"os"
"path/filepath"
"testing"
rtest "github.com/restic/restic/internal/test"
)
func TestFreadlink(t *testing.T) {
tmpdir := t.TempDir()
link := filepath.Join(tmpdir, "link")
rtest.OK(t, os.Symlink("other", link))
f, err := openMetadataHandle(link, O_NOFOLLOW)
rtest.OK(t, err)
target, err := Freadlink(f.Fd(), link)
rtest.OK(t, err)
rtest.Equals(t, "other", target)
}