From 5a6c9b3d5889d48d647f2a165c9bba8b966d3a22 Mon Sep 17 00:00:00 2001 From: Sam Deane Date: Tue, 24 Mar 2020 17:23:27 +0000 Subject: [PATCH] Use productsDirectory for run command --- Sources/XCTestExtensions/XCTestExtensions.swift | 3 ++- Sources/XCTestExtensions/XCTestRunner.swift | 9 --------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Sources/XCTestExtensions/XCTestExtensions.swift b/Sources/XCTestExtensions/XCTestExtensions.swift index 215d38d..71a143f 100644 --- a/Sources/XCTestExtensions/XCTestExtensions.swift +++ b/Sources/XCTestExtensions/XCTestExtensions.swift @@ -156,7 +156,8 @@ extension XCTestCase { /// Run an external executable in the same location as the test bundle, and /// return its output. public func run(_ command: String, arguments: [String] = []) -> XCTestRunner.Result { - let runner = XCTestRunner(for: command) + let url = productsDirectory.appendingPathComponent(command) + let runner = XCTestRunner(for: url) let result = runner.run(with: arguments) return result } diff --git a/Sources/XCTestExtensions/XCTestRunner.swift b/Sources/XCTestExtensions/XCTestRunner.swift index 87a2adf..a13a0f7 100644 --- a/Sources/XCTestExtensions/XCTestRunner.swift +++ b/Sources/XCTestExtensions/XCTestRunner.swift @@ -27,15 +27,6 @@ public class XCTestRunner { self.cwd = cwd } - /** - Initialise to run a command in the same built products directory as this test bundle. - */ - - public convenience init(for command: String, cwd: URL? = nil, environment: [String:String] = ProcessInfo.processInfo.environment) { - let url = Bundle(for: XCTestRunner.self).bundleURL.deletingLastPathComponent() - self.init(for: url.appendingPathComponent(command), cwd: cwd, environment: environment) - } - /** Invoke a command and some optional arguments synchronously.