Skip to content

Commit 7716988

Browse files
committed
SR-6531: Check the file copy worked in the tests
(cherry picked from commit a16c18c)
1 parent e297bbc commit 7716988

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

TestFoundation/TestFileManager.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,13 +1078,15 @@ class TestFileManager : XCTestCase {
10781078
let srcFile = tmpDir.appendingPathComponent("file1.txt")
10791079
let destFile = tmpDir.appendingPathComponent("file2.txt")
10801080

1081+
let source = "This is the source file"
10811082
try? fm.removeItem(at: srcFile)
1082-
try "This is the source file".write(toFile: srcFile.path, atomically: false, encoding: .utf8)
1083+
try source.write(toFile: srcFile.path, atomically: false, encoding: .utf8)
10831084

10841085
func testCopy() throws {
10851086
try? fm.removeItem(at: destFile)
10861087
try fm.copyItem(at: srcFile, to: destFile)
1087-
1088+
let copy = try String(contentsOf: destFile)
1089+
XCTAssertEqual(source, copy)
10881090
if let srcPerms = (try fm.attributesOfItem(atPath: srcFile.path)[.posixPermissions] as? NSNumber)?.intValue,
10891091
let destPerms = (try fm.attributesOfItem(atPath: destFile.path)[.posixPermissions] as? NSNumber)?.intValue {
10901092
XCTAssertEqual(srcPerms, destPerms)

0 commit comments

Comments
 (0)