File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Tests/SwiftDocCoverageTests Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 11import XCTest
22@testable import SwiftDocCoverage
33
4+ func tempDirectory( ) -> URL {
5+ let url = URL ( fileURLWithPath: NSTemporaryDirectory ( ) )
6+ . appendingPathComponent ( ProcessInfo . processInfo. globallyUniqueString)
7+ try ? FileManager . default. createDirectory ( at: url, withIntermediateDirectories: true )
8+ return url
9+ }
410
511final class DeclarationTests : XCTestCase {
612
@@ -399,7 +405,10 @@ final class FileTests: XCTestCase {
399405 }
400406
401407 func test_empty_directory( ) throws {
402- XCTAssertThrowsError ( try Coverage ( paths: [ Self . emptyDirURL. path] , minAccessLevel: . public) ) { error in
408+ let tempDirectory = tempDirectory ( )
409+ defer { try ? FileManager . default. removeItem ( at: tempDirectory) }
410+
411+ XCTAssertThrowsError ( try Coverage ( paths: [ tempDirectory. path] , minAccessLevel: . public) ) { error in
403412 XCTAssert ( error. localizedDescription == " Swift files not found. " )
404413 }
405414 }
@@ -492,7 +501,7 @@ final class ToolTests: XCTestCase {
492501 }
493502
494503 func test_file_output( ) throws {
495- let tempDirectory = URL ( fileURLWithPath : NSTemporaryDirectory ( ) ) . appendingPathComponent ( ProcessInfo . processInfo . globallyUniqueString )
504+ let tempDirectory = tempDirectory ( )
496505 let outputFileURL = tempDirectory. appendingPathComponent ( " report.txt " )
497506 defer { try ? FileManager . default. removeItem ( at: tempDirectory) }
498507
You can’t perform that action at this time.
0 commit comments