We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C:\go\root\src\pkg\os>hg id f3bac1f13638+ C:\go\root\src\pkg\os>hg diff diff -r f3bac1f13638 src/pkg/os/os_windows_test.go --- a/src/pkg/os/os_windows_test.go Thu Aug 07 10:25:50 2014 +1000 +++ b/src/pkg/os/os_windows_test.go Thu Aug 07 15:06:21 2014 +1000 @@ -4,7 +4,9 @@ "io/ioutil" "os" "path/filepath" + "runtime" "syscall" + "testing" ) func init() { @@ -25,3 +27,58 @@ supportsSymlinks = false } } + +func TestSameWindowsFile(t *testing.T) { + temp, err := ioutil.TempDir("", "TestSameWindowsFile") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(temp) + + wd, err := os.Getwd() + if err != nil { + t.Fatal(err) + } + err = os.Chdir(temp) + if err != nil { + t.Fatal(err) + } + defer os.Chdir(wd) + + f, err := os.Create("a") + if err != nil { + t.Fatal(err) + } + f.Close() + + ia1, err := os.Stat("a") + if err != nil { + t.Fatal(err) + } + + path, err := filepath.Abs("a") + if err != nil { + t.Fatal(err) + } + ia2, err := os.Stat(path) + if err != nil { + t.Fatal(err) + } + if !os.SameFile(ia1, ia2) { + t.Errorf("files should be same") + } + + if runtime.GOOS == "windows" { + p := filepath.VolumeName(path) + filepath.Base(path) + if err != nil { + t.Fatal(err) + } + ia3, err := os.Stat(p) + if err != nil { + t.Fatal(err) + } + if !os.SameFile(ia1, ia3) { + t.Errorf("files should be same") + } + } +} C:\go\root\src\pkg\os>go test -run=SameWindowsFile --- FAIL: TestSameWindowsFile (0.00s) os_windows_test.go:81: files should be same FAIL exit status 1 FAIL os 0.094s Alex
The text was updated successfully, but these errors were encountered:
Comment 1:
CL https://golang.org/cl/127740043 mentions this issue.
Sorry, something went wrong.
Comment 2:
This issue was closed by revision 2de65ca.
Status changed to Fixed.
os: make SameFile handle paths like c:a.txt properly
cab62df
Fixes golang#8490. LGTM=r, rsc R=golang-codereviews, rsc, bradfitz, r CC=golang-codereviews https://golang.org/cl/127740043
d6d0b9c
No branches or pull requests
The text was updated successfully, but these errors were encountered: