os: pull in os.Rename and some of its tests from upstream

Skip part of the test on Windows because of https://github.com/tinygo-org/tinygo/issues/2480

TODO: fix 2480 and unskip test
TODO: pull in rest of upstream tests, fix problems they find

Requested in https://github.com/tinygo-org/tinygo/issues/2109
This commit is contained in:
Dan Kegel
2022-01-03 10:52:41 -08:00
committed by Ron Evans
parent 72e15af1fa
commit 29f7ebc63e
5 changed files with 127 additions and 1 deletions
+8
View File
@@ -40,6 +40,14 @@ func Chdir(dir string) error {
return nil
}
// Rename renames (moves) oldpath to newpath.
// If newpath already exists and is not a directory, Rename replaces it.
// OS-specific restrictions may apply when oldpath and newpath are in different directories.
// If there is an error, it will be of type *LinkError.
func Rename(oldpath, newpath string) error {
return rename(oldpath, newpath)
}
// unixFilesystem is an empty handle for a Unix/Linux filesystem. All operations
// are relative to the current working directory.
type unixFilesystem struct {