|
@@ -297,9 +297,10 @@ func TestCopyLongDstFilename(t *testing.T) {
|
|
// J | yes | yes | yes | yes | - | copy dir contents
|
|
// J | yes | yes | yes | yes | - | copy dir contents
|
|
//
|
|
//
|
|
|
|
|
|
-// A. SRC specifies a file and DST (no trailing path separator) doesn't
|
|
|
|
-// exist. This should create a file with the name DST and copy the
|
|
|
|
-// contents of the source file into it.
|
|
|
|
|
|
+// A. SRC specifies a file and DST (no trailing path separator) doesn't exist.
|
|
|
|
+//
|
|
|
|
+// This should create a file with the name DST and copy the contents of the source
|
|
|
|
+// file into it.
|
|
func TestCopyCaseA(t *testing.T) {
|
|
func TestCopyCaseA(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -339,9 +340,10 @@ func TestCopyCaseA(t *testing.T) {
|
|
assert.NilError(t, err)
|
|
assert.NilError(t, err)
|
|
}
|
|
}
|
|
|
|
|
|
-// B. SRC specifies a file and DST (with trailing path separator) doesn't
|
|
|
|
-// exist. This should cause an error because the copy operation cannot
|
|
|
|
-// create a directory when copying a single file.
|
|
|
|
|
|
+// B. SRC specifies a file and DST (with trailing path separator) doesn't exist.
|
|
|
|
+//
|
|
|
|
+// This should cause an error because the copy operation cannot create a directory
|
|
|
|
+// when copying a single file.
|
|
func TestCopyCaseB(t *testing.T) {
|
|
func TestCopyCaseB(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -373,8 +375,9 @@ func TestCopyCaseB(t *testing.T) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-// C. SRC specifies a file and DST exists as a file. This should overwrite
|
|
|
|
-// the file at DST with the contents of the source file.
|
|
|
|
|
|
+// C. SRC specifies a file and DST exists as a file.
|
|
|
|
+//
|
|
|
|
+// This should overwrite the file at DST with the contents of the source file.
|
|
func TestCopyCaseC(t *testing.T) {
|
|
func TestCopyCaseC(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -401,9 +404,9 @@ func TestCopyCaseC(t *testing.T) {
|
|
assert.NilError(t, err)
|
|
assert.NilError(t, err)
|
|
}
|
|
}
|
|
|
|
|
|
-// C. Symbol link following version:
|
|
|
|
-// SRC specifies a file and DST exists as a file. This should overwrite
|
|
|
|
-// the file at DST with the contents of the source file.
|
|
|
|
|
|
+// C. Symbol link following version: SRC specifies a file and DST exists as a file.
|
|
|
|
+//
|
|
|
|
+// This should overwrite the file at DST with the contents of the source file.
|
|
func TestCopyCaseCFSym(t *testing.T) {
|
|
func TestCopyCaseCFSym(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -438,9 +441,10 @@ func TestCopyCaseCFSym(t *testing.T) {
|
|
assert.NilError(t, err)
|
|
assert.NilError(t, err)
|
|
}
|
|
}
|
|
|
|
|
|
-// D. SRC specifies a file and DST exists as a directory. This should place
|
|
|
|
-// a copy of the source file inside it using the basename from SRC. Ensure
|
|
|
|
-// this works whether DST has a trailing path separator or not.
|
|
|
|
|
|
+// D. SRC specifies a file and DST exists as a directory.
|
|
|
|
+//
|
|
|
|
+// This should place a copy of the source file inside it using the basename from
|
|
|
|
+// SRC. Ensure this works whether DST has a trailing path separator or not.
|
|
func TestCopyCaseD(t *testing.T) {
|
|
func TestCopyCaseD(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -487,10 +491,10 @@ func TestCopyCaseD(t *testing.T) {
|
|
assert.NilError(t, err)
|
|
assert.NilError(t, err)
|
|
}
|
|
}
|
|
|
|
|
|
-// D. Symbol link following version:
|
|
|
|
-// SRC specifies a file and DST exists as a directory. This should place
|
|
|
|
-// a copy of the source file inside it using the basename from SRC. Ensure
|
|
|
|
-// this works whether DST has a trailing path separator or not.
|
|
|
|
|
|
+// D. Symbol link following version: SRC specifies a file and DST exists as a directory.
|
|
|
|
+//
|
|
|
|
+// This should place a copy of the source file inside it using the basename from
|
|
|
|
+// SRC. Ensure this works whether DST has a trailing path separator or not.
|
|
func TestCopyCaseDFSym(t *testing.T) {
|
|
func TestCopyCaseDFSym(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -538,10 +542,11 @@ func TestCopyCaseDFSym(t *testing.T) {
|
|
assert.NilError(t, err)
|
|
assert.NilError(t, err)
|
|
}
|
|
}
|
|
|
|
|
|
-// E. SRC specifies a directory and DST does not exist. This should create a
|
|
|
|
-// directory at DST and copy the contents of the SRC directory into the DST
|
|
|
|
-// directory. Ensure this works whether DST has a trailing path separator or
|
|
|
|
-// not.
|
|
|
|
|
|
+// E. SRC specifies a directory and DST does not exist.
|
|
|
|
+//
|
|
|
|
+// This should create a directory at DST and copy the contents of the SRC directory
|
|
|
|
+// into the DST directory. Ensure this works whether DST has a trailing path
|
|
|
|
+// separator or not.
|
|
func TestCopyCaseE(t *testing.T) {
|
|
func TestCopyCaseE(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -581,11 +586,11 @@ func TestCopyCaseE(t *testing.T) {
|
|
assert.NilError(t, err)
|
|
assert.NilError(t, err)
|
|
}
|
|
}
|
|
|
|
|
|
-// E. Symbol link following version:
|
|
|
|
-// SRC specifies a directory and DST does not exist. This should create a
|
|
|
|
-// directory at DST and copy the contents of the SRC directory into the DST
|
|
|
|
-// directory. Ensure this works whether DST has a trailing path separator or
|
|
|
|
-// not.
|
|
|
|
|
|
+// E. Symbol link following version: SRC specifies a directory and DST does not exist.
|
|
|
|
+//
|
|
|
|
+// This should create a directory at DST and copy the contents of the SRC directory
|
|
|
|
+// into the DST directory. Ensure this works whether DST has a trailing path
|
|
|
|
+// separator or not.
|
|
func TestCopyCaseEFSym(t *testing.T) {
|
|
func TestCopyCaseEFSym(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -626,8 +631,10 @@ func TestCopyCaseEFSym(t *testing.T) {
|
|
assert.NilError(t, err)
|
|
assert.NilError(t, err)
|
|
}
|
|
}
|
|
|
|
|
|
-// F. SRC specifies a directory and DST exists as a file. This should cause an
|
|
|
|
-// error as it is not possible to overwrite a file with a directory.
|
|
|
|
|
|
+// F. SRC specifies a directory and DST exists as a file.
|
|
|
|
+//
|
|
|
|
+// This should cause an error as it is not possible to overwrite a file with a
|
|
|
|
+// directory.
|
|
func TestCopyCaseF(t *testing.T) {
|
|
func TestCopyCaseF(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -660,9 +667,10 @@ func TestCopyCaseF(t *testing.T) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// G. SRC specifies a directory and DST exists as a directory. This should copy
|
|
|
|
-// the SRC directory and all its contents to the DST directory. Ensure this
|
|
|
|
-// works whether DST has a trailing path separator or not.
|
|
|
|
|
|
+// G. SRC specifies a directory and DST exists as a directory.
|
|
|
|
+//
|
|
|
|
+// This should copy the SRC directory and all its contents to the DST directory.
|
|
|
|
+// Ensure this works whether DST has a trailing path separator or not.
|
|
func TestCopyCaseG(t *testing.T) {
|
|
func TestCopyCaseG(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -704,10 +712,10 @@ func TestCopyCaseG(t *testing.T) {
|
|
assert.NilError(t, err)
|
|
assert.NilError(t, err)
|
|
}
|
|
}
|
|
|
|
|
|
-// G. Symbol link version:
|
|
|
|
-// SRC specifies a directory and DST exists as a directory. This should copy
|
|
|
|
-// the SRC directory and all its contents to the DST directory. Ensure this
|
|
|
|
-// works whether DST has a trailing path separator or not.
|
|
|
|
|
|
+// G. Symbol link version: SRC specifies a directory and DST exists as a directory.
|
|
|
|
+//
|
|
|
|
+// This should copy the SRC directory and all its contents to the DST directory.
|
|
|
|
+// Ensure this works whether DST has a trailing path separator or not.
|
|
func TestCopyCaseGFSym(t *testing.T) {
|
|
func TestCopyCaseGFSym(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -750,10 +758,11 @@ func TestCopyCaseGFSym(t *testing.T) {
|
|
assert.NilError(t, err)
|
|
assert.NilError(t, err)
|
|
}
|
|
}
|
|
|
|
|
|
-// H. SRC specifies a directory's contents only and DST does not exist. This
|
|
|
|
-// should create a directory at DST and copy the contents of the SRC
|
|
|
|
-// directory (but not the directory itself) into the DST directory. Ensure
|
|
|
|
-// this works whether DST has a trailing path separator or not.
|
|
|
|
|
|
+// H. SRC specifies a directory's contents only and DST does not exist.
|
|
|
|
+//
|
|
|
|
+// This should create a directory at DST and copy the contents of the SRC
|
|
|
|
+// directory (but not the directory itself) into the DST directory. Ensure
|
|
|
|
+// this works whether DST has a trailing path separator or not.
|
|
func TestCopyCaseH(t *testing.T) {
|
|
func TestCopyCaseH(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -797,11 +806,11 @@ func TestCopyCaseH(t *testing.T) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// H. Symbol link following version:
|
|
|
|
-// SRC specifies a directory's contents only and DST does not exist. This
|
|
|
|
-// should create a directory at DST and copy the contents of the SRC
|
|
|
|
-// directory (but not the directory itself) into the DST directory. Ensure
|
|
|
|
-// this works whether DST has a trailing path separator or not.
|
|
|
|
|
|
+// H. Symbol link following version: SRC specifies a directory's contents only and DST does not exist.
|
|
|
|
+//
|
|
|
|
+// This should create a directory at DST and copy the contents of the SRC
|
|
|
|
+// directory (but not the directory itself) into the DST directory. Ensure
|
|
|
|
+// this works whether DST has a trailing path separator or not.
|
|
func TestCopyCaseHFSym(t *testing.T) {
|
|
func TestCopyCaseHFSym(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -846,9 +855,10 @@ func TestCopyCaseHFSym(t *testing.T) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// I. SRC specifies a directory's contents only and DST exists as a file. This
|
|
|
|
-// should cause an error as it is not possible to overwrite a file with a
|
|
|
|
-// directory.
|
|
|
|
|
|
+// I. SRC specifies a directory's contents only and DST exists as a file.
|
|
|
|
+//
|
|
|
|
+// This should cause an error as it is not possible to overwrite a file with a
|
|
|
|
+// directory.
|
|
func TestCopyCaseI(t *testing.T) {
|
|
func TestCopyCaseI(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -882,9 +892,10 @@ func TestCopyCaseI(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
// J. SRC specifies a directory's contents only and DST exists as a directory.
|
|
// J. SRC specifies a directory's contents only and DST exists as a directory.
|
|
-// This should copy the contents of the SRC directory (but not the directory
|
|
|
|
-// itself) into the DST directory. Ensure this works whether DST has a
|
|
|
|
-// trailing path separator or not.
|
|
|
|
|
|
+//
|
|
|
|
+// This should copy the contents of the SRC directory (but not the directory
|
|
|
|
+// itself) into the DST directory. Ensure this works whether DST has a
|
|
|
|
+// trailing path separator or not.
|
|
func TestCopyCaseJ(t *testing.T) {
|
|
func TestCopyCaseJ(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
@@ -930,11 +941,11 @@ func TestCopyCaseJ(t *testing.T) {
|
|
assert.NilError(t, err)
|
|
assert.NilError(t, err)
|
|
}
|
|
}
|
|
|
|
|
|
-// J. Symbol link following version:
|
|
|
|
-// SRC specifies a directory's contents only and DST exists as a directory.
|
|
|
|
-// This should copy the contents of the SRC directory (but not the directory
|
|
|
|
-// itself) into the DST directory. Ensure this works whether DST has a
|
|
|
|
-// trailing path separator or not.
|
|
|
|
|
|
+// J. Symbol link following version: SRC specifies a directory's contents only and DST exists as a directory.
|
|
|
|
+//
|
|
|
|
+// This should copy the contents of the SRC directory (but not the directory
|
|
|
|
+// itself) into the DST directory. Ensure this works whether DST has a
|
|
|
|
+// trailing path separator or not.
|
|
func TestCopyCaseJFSym(t *testing.T) {
|
|
func TestCopyCaseJFSym(t *testing.T) {
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
tmpDirA, tmpDirB := getTestTempDirs(t)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|
|
defer removeAllPaths(tmpDirA, tmpDirB)
|