| // Copyright 2012 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| func TestErrIsExistAfterRename(t *testing.T) { |
| dir, err := ioutil.TempDir("", "go-build") |
| t.Fatalf("Create temp directory: %v", err) |
| src := filepath.Join(dir, "src") |
| dest := filepath.Join(dir, "dest") |
| t.Fatalf("Create file %v: %v", src, err) |
| err = os.Rename(src, dest) |
| t.Fatalf("Rename %v to %v: %v", src, dest, err) |
| t.Fatalf("Create file %v: %v", src, err) |
| err = os.Rename(src, dest) |
| t.Fatal("Rename should have failed") |
| if s := checkErrorPredicate("os.IsExist", os.IsExist, err); s != "" { |