mirror of
https://github.com/golang/go
synced 2024-11-11 22:50:22 -07:00
os: run TestStatSymlinkLoop on all platforms
The test doesn't seem to be specific to Windows, so run in on all platforms supporting symlinks. Change-Id: I0bbae10040d86e313c285bee2c465df2135fd777 Reviewed-on: https://go-review.googlesource.com/c/go/+/397574 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
01c83be793
commit
8e50298f12
@ -223,6 +223,29 @@ func TestStatError(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestStatSymlinkLoop(t *testing.T) {
|
||||
testenv.MustHaveSymlink(t)
|
||||
|
||||
defer chtmpdir(t)()
|
||||
|
||||
err := os.Symlink("x", "y")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.Remove("y")
|
||||
|
||||
err = os.Symlink("y", "x")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.Remove("x")
|
||||
|
||||
_, err = os.Stat("x")
|
||||
if _, ok := err.(*fs.PathError); !ok {
|
||||
t.Errorf("expected *PathError, got %T: %v\n", err, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFstat(t *testing.T) {
|
||||
path := sfdir + "/" + sfname
|
||||
file, err1 := Open(path)
|
||||
|
@ -643,29 +643,6 @@ func TestDeleteReadOnly(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestStatSymlinkLoop(t *testing.T) {
|
||||
testenv.MustHaveSymlink(t)
|
||||
|
||||
defer chtmpdir(t)()
|
||||
|
||||
err := os.Symlink("x", "y")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.Remove("y")
|
||||
|
||||
err = os.Symlink("y", "x")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.Remove("x")
|
||||
|
||||
_, err = os.Stat("x")
|
||||
if _, ok := err.(*fs.PathError); !ok {
|
||||
t.Errorf("expected *PathError, got %T: %v\n", err, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReadStdin(t *testing.T) {
|
||||
old := poll.ReadConsole
|
||||
defer func() {
|
||||
|
Loading…
Reference in New Issue
Block a user