Skip to content

Commit 5d145f6

Browse files
committed
chore: Unit tests
1 parent 95314f5 commit 5d145f6

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

SwiftFITSTests/FITSFile.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,20 @@ struct Test_FITSFile
5353

5454
#expect( throws: FITSError.self ) { try FITSFile( url: url ) }
5555

56-
try? FileManager.default.removeItem( at: url )
56+
try FileManager.default.removeItem( at: url )
57+
}
58+
59+
@Test
60+
func unreadableFile() async throws
61+
{
62+
let url = URL( fileURLWithPath: NSTemporaryDirectory(), isDirectory: true ).appending( component: UUID().uuidString ).appendingPathExtension( "fits" )
63+
64+
try #require( FileManager.default.fileExists( atPath: url.path ) == false )
65+
try #require( FileManager.default.createFile( atPath: url.path, contents: Data(), attributes: [ .posixPermissions: 0666 ] ) )
66+
67+
#expect( throws: FITSError.self ) { try FITSFile( url: url ) }
68+
69+
try FileManager.default.removeItem( at: url )
5770
}
5871

5972
@Test

0 commit comments

Comments
 (0)