@@ -86,23 +86,23 @@ final class XcodesKitTests: XCTestCase {
86
86
87
87
let xcode = Xcode ( version: Version ( " 0.0.0 " ) !, url: URL ( fileURLWithPath: " / " ) , filename: " mock " , releaseDate: nil )
88
88
let installedXcode = InstalledXcode ( path: Path ( " /Applications/Xcode-0.0.0.app " ) !) !
89
- installer. installArchivedXcode ( xcode, at: URL ( fileURLWithPath: " /Xcode-0.0.0.xip " ) , to: Path . root. join ( " Applications " ) , noSuperuser: false )
89
+ installer. installArchivedXcode ( xcode, at: URL ( fileURLWithPath: " /Xcode-0.0.0.xip " ) , to: Path . root. join ( " Applications " ) , emptyTrash : false , noSuperuser: false )
90
90
. catch { error in XCTAssertEqual ( error as! XcodeInstaller . Error , XcodeInstaller . Error. failedSecurityAssessment ( xcode: installedXcode, output: " " ) ) }
91
91
}
92
92
93
93
func test_InstallArchivedXcode_VerifySigningCertificateFails_Throws( ) {
94
94
Current . shell. codesignVerify = { _ in return Promise ( error: Process . PMKError. execution ( process: Process ( ) , standardOutput: nil , standardError: nil ) ) }
95
95
96
96
let xcode = Xcode ( version: Version ( " 0.0.0 " ) !, url: URL ( fileURLWithPath: " / " ) , filename: " mock " , releaseDate: nil )
97
- installer. installArchivedXcode ( xcode, at: URL ( fileURLWithPath: " /Xcode-0.0.0.xip " ) , to: Path . root. join ( " Applications " ) , noSuperuser: false )
97
+ installer. installArchivedXcode ( xcode, at: URL ( fileURLWithPath: " /Xcode-0.0.0.xip " ) , to: Path . root. join ( " Applications " ) , emptyTrash : false , noSuperuser: false )
98
98
. catch { error in XCTAssertEqual ( error as! XcodeInstaller . Error , XcodeInstaller . Error. codesignVerifyFailed ( output: " " ) ) }
99
99
}
100
100
101
101
func test_InstallArchivedXcode_VerifySigningCertificateDoesntMatch_Throws( ) {
102
102
Current . shell. codesignVerify = { _ in return Promise . value ( ( 0 , " " , " " ) ) }
103
103
104
104
let xcode = Xcode ( version: Version ( " 0.0.0 " ) !, url: URL ( fileURLWithPath: " / " ) , filename: " mock " , releaseDate: nil )
105
- installer. installArchivedXcode ( xcode, at: URL ( fileURLWithPath: " /Xcode-0.0.0.xip " ) , to: Path . root. join ( " Applications " ) , noSuperuser: false )
105
+ installer. installArchivedXcode ( xcode, at: URL ( fileURLWithPath: " /Xcode-0.0.0.xip " ) , to: Path . root. join ( " Applications " ) , emptyTrash : false , noSuperuser: false )
106
106
. catch { error in XCTAssertEqual ( error as! XcodeInstaller . Error , XcodeInstaller . Error. unexpectedCodeSigningIdentity ( identifier: " " , certificateAuthority: [ ] ) ) }
107
107
}
108
108
@@ -115,7 +115,7 @@ final class XcodesKitTests: XCTestCase {
115
115
116
116
let xcode = Xcode ( version: Version ( " 0.0.0 " ) !, url: URL ( fileURLWithPath: " / " ) , filename: " mock " , releaseDate: nil )
117
117
let xipURL = URL ( fileURLWithPath: " /Xcode-0.0.0.xip " )
118
- installer. installArchivedXcode ( xcode, at: xipURL, to: Path . root. join ( " Applications " ) , noSuperuser: false )
118
+ installer. installArchivedXcode ( xcode, at: xipURL, to: Path . root. join ( " Applications " ) , emptyTrash : false , noSuperuser: false )
119
119
. ensure { XCTAssertEqual ( trashedItemAtURL, xipURL) }
120
120
. cauterize ( )
121
121
}
@@ -203,7 +203,7 @@ final class XcodesKitTests: XCTestCase {
203
203
204
204
let expectation = self . expectation ( description: " Finished " )
205
205
206
- installer. install ( . version( " 0.0.0 " ) , dataSource: . apple, downloader: . urlSession, destination: Path . root. join ( " Applications " ) , noSuperuser: false )
206
+ installer. install ( . version( " 0.0.0 " ) , dataSource: . apple, downloader: . urlSession, destination: Path . root. join ( " Applications " ) , emptyTrash : false , noSuperuser: false )
207
207
. ensure {
208
208
let url = Bundle . module. url ( forResource: " LogOutput-FullHappyPath " , withExtension: " txt " , subdirectory: " Fixtures " ) !
209
209
XCTAssertEqual ( log, try ! String ( contentsOf: url) )
@@ -296,7 +296,7 @@ final class XcodesKitTests: XCTestCase {
296
296
297
297
let expectation = self . expectation ( description: " Finished " )
298
298
299
- installer. install ( . version( " 0.0.0 " ) , dataSource: . apple, downloader: . urlSession, destination: Path . root. join ( " Applications " ) , noSuperuser: false )
299
+ installer. install ( . version( " 0.0.0 " ) , dataSource: . apple, downloader: . urlSession, destination: Path . root. join ( " Applications " ) , emptyTrash : false , noSuperuser: false )
300
300
. ensure {
301
301
let url = Bundle . module. url ( forResource: " LogOutput-FullHappyPath-NoColor " , withExtension: " txt " , subdirectory: " Fixtures " ) !
302
302
XCTAssertEqual ( log, try ! String ( contentsOf: url) )
@@ -393,7 +393,7 @@ final class XcodesKitTests: XCTestCase {
393
393
394
394
let expectation = self . expectation ( description: " Finished " )
395
395
396
- installer. install ( . version( " 0.0.0 " ) , dataSource: . apple, downloader: . urlSession, destination: Path . root. join ( " Applications " ) , noSuperuser: false )
396
+ installer. install ( . version( " 0.0.0 " ) , dataSource: . apple, downloader: . urlSession, destination: Path . root. join ( " Applications " ) , emptyTrash : false , noSuperuser: false )
397
397
. ensure {
398
398
let url = Bundle . module. url ( forResource: " LogOutput-FullHappyPath-NonInteractiveTerminal " , withExtension: " txt " , subdirectory: " Fixtures " ) !
399
399
XCTAssertEqual ( log, try ! String ( contentsOf: url) )
@@ -486,7 +486,7 @@ final class XcodesKitTests: XCTestCase {
486
486
487
487
let expectation = self . expectation ( description: " Finished " )
488
488
489
- installer. install ( . version( " 0.0.0 " ) , dataSource: . apple, downloader: . urlSession, destination: Path . home. join ( " Xcode " ) , noSuperuser: false )
489
+ installer. install ( . version( " 0.0.0 " ) , dataSource: . apple, downloader: . urlSession, destination: Path . home. join ( " Xcode " ) , emptyTrash : false , noSuperuser: false )
490
490
. ensure {
491
491
let url = Bundle . module. url ( forResource: " LogOutput-AlternativeDirectory " , withExtension: " txt " , subdirectory: " Fixtures " ) !
492
492
let expectedText = try ! String ( contentsOf: url) . replacingOccurrences ( of: " /Users/brandon " , with: Path . home. string)
@@ -600,7 +600,7 @@ final class XcodesKitTests: XCTestCase {
600
600
601
601
let expectation = self . expectation ( description: " Finished " )
602
602
603
- installer. install ( . version( " 0.0.0 " ) , dataSource: . apple, downloader: . urlSession, destination: Path . root. join ( " Applications " ) , noSuperuser: false )
603
+ installer. install ( . version( " 0.0.0 " ) , dataSource: . apple, downloader: . urlSession, destination: Path . root. join ( " Applications " ) , emptyTrash : false , noSuperuser: false )
604
604
. ensure {
605
605
let url = Bundle . module. url ( forResource: " LogOutput-IncorrectSavedPassword " , withExtension: " txt " , subdirectory: " Fixtures " ) !
606
606
XCTAssertEqual ( log, try ! String ( contentsOf: url) )
@@ -718,7 +718,7 @@ final class XcodesKitTests: XCTestCase {
718
718
719
719
let expectation = self . expectation ( description: " Finished " )
720
720
721
- installer. install ( . version( " 0.0.0 " ) , dataSource: . apple, downloader: . urlSession, destination: Path . root. join ( " Applications " ) , noSuperuser: false )
721
+ installer. install ( . version( " 0.0.0 " ) , dataSource: . apple, downloader: . urlSession, destination: Path . root. join ( " Applications " ) , emptyTrash : false , noSuperuser: false )
722
722
. ensure {
723
723
let url = Bundle . module. url ( forResource: " LogOutput-DamagedXIP " , withExtension: " txt " , subdirectory: " Fixtures " ) !
724
724
let expectedText = try ! String ( contentsOf: url) . replacingOccurrences ( of: " /Users/brandon " , with: Path . home. string)
@@ -778,7 +778,7 @@ final class XcodesKitTests: XCTestCase {
778
778
return Promise . value ( ( status: 0 , out: " " , err: " " ) )
779
779
}
780
780
781
- installer. uninstallXcode ( " 0.0.0 " , directory: Path . root. join ( " Applications " ) )
781
+ installer. uninstallXcode ( " 0.0.0 " , directory: Path . root. join ( " Applications " ) , emptyTrash : false )
782
782
. ensure {
783
783
XCTAssertEqual ( selectedPaths, [ " /Applications/Xcode-2.0.1.app " ] )
784
784
XCTAssertEqual ( trashedItemAtURL, installedXcodes [ 0 ] . path. url)
@@ -823,7 +823,7 @@ final class XcodesKitTests: XCTestCase {
823
823
return URL ( fileURLWithPath: " \( NSHomeDirectory ( ) ) /.Trash/ \( itemURL. lastPathComponent) " )
824
824
}
825
825
826
- installer. uninstallXcode ( " 999 " , directory: Path . root. join ( " Applications " ) )
826
+ installer. uninstallXcode ( " 999 " , directory: Path . root. join ( " Applications " ) , emptyTrash : false )
827
827
. ensure {
828
828
XCTAssertEqual ( trashedItemAtURL, installedXcodes [ 0 ] . path. url)
829
829
}
0 commit comments