Skip to content

Commit 6b6d78a

Browse files
committed
Fix a filesystem-sensitive test
1 parent fd7e89d commit 6b6d78a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: Tests/TestingTests/AttachmentTests.swift

+7
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ struct AttachmentTests {
8383
let attachableValue = MyAttachable(string: "<!doctype html>")
8484
let attachment = Test.Attachment(attachableValue, named: "loremipsum.tar.gz.gif.jpeg.html")
8585

86+
// Write the attachment to disk once to ensure the original filename is not
87+
// available and we add a suffix.
88+
let originalFilePath = try attachment.write(toFileInDirectoryAtPath: temporaryDirectory())
89+
defer {
90+
remove(originalFilePath)
91+
}
92+
8693
// Write the attachment to disk, then read it back.
8794
let suffix = String(UInt64.random(in: 0 ..< .max), radix: 36)
8895
let filePath = try attachment.write(toFileInDirectoryAtPath: temporaryDirectory(), appending: suffix)

0 commit comments

Comments
 (0)