diff --git a/Tests/GenIRTests/MultipleAppTests.swift b/Tests/GenIRTests/MultipleAppTests.swift index 9791fa0..90b0042 100644 --- a/Tests/GenIRTests/MultipleAppTests.swift +++ b/Tests/GenIRTests/MultipleAppTests.swift @@ -18,7 +18,7 @@ final class MultipleAppTests: XCTestCase { let app = try XCTUnwrap(targets.first(where: { $0.name == "MultipleApp" })) let copy = try XCTUnwrap(targets.first(where: { $0.name == "MultipleApp Copy" })) - XCTAssertEqual(app.commands.count, 3) - XCTAssertEqual(copy.commands.count, 3) + XCTAssertEqual(context.logParser.targetCommands[app.name]?.count, 3) + XCTAssertEqual(context.logParser.targetCommands[copy.name]?.count, 3) } } diff --git a/Tests/GenIRTests/TestContext.swift b/Tests/GenIRTests/TestContext.swift index 40f7230..401fa92 100644 --- a/Tests/GenIRTests/TestContext.swift +++ b/Tests/GenIRTests/TestContext.swift @@ -145,7 +145,7 @@ class TestContext { /// Generate the Targets for this context lazy var targets: [Target] = { - Target.targets(from: pifCache.targets, with: logParser.targetCommands) + pifCache.targets.map { Target(from: $0) } }() /// Generate the dependency graph for this context diff --git a/Tests/GenIRTests/UmbrellaTests.swift b/Tests/GenIRTests/UmbrellaTests.swift index 13a40af..2b86381 100644 --- a/Tests/GenIRTests/UmbrellaTests.swift +++ b/Tests/GenIRTests/UmbrellaTests.swift @@ -11,10 +11,10 @@ final class UmbrellaTests: XCTestCase { let scheme = "Umbrella" let targetsToFiles = [ - "Common.framework": ["OrgModel.bc"].sorted(), - "Networking.framework": ["Networking.bc"].sorted(), - "Pods_Umbrella.framework": [], - "Umbrella.framework": ["GetOrg.bc"].sorted() + "Common.framework": ["Common-dummy.bc", "Common_vers.bc", "OrgModel.bc"].sorted(), + "Networking.framework": ["Networking-dummy.bc", "Networking.bc", "Networking_vers.bc"].sorted(), + "Pods_Umbrella.framework": ["Pods-Umbrella-dummy.bc", "Pods_Umbrella_vers.bc"], + "Umbrella.framework": ["GetOrg.bc", "Umbrella_vers.bc"].sorted() ] func testUmbrellaTargets() throws { diff --git a/Tests/GenIRTests/WorkspaceTests.swift b/Tests/GenIRTests/WorkspaceTests.swift index 711e66f..d9f56d3 100644 --- a/Tests/GenIRTests/WorkspaceTests.swift +++ b/Tests/GenIRTests/WorkspaceTests.swift @@ -11,8 +11,8 @@ final class WorkspaceTests: XCTestCase { let scheme = "App" static let appIRFiles: Set = ["AppApp.bc", "ContentView.bc", "GeneratedAssetSymbols.bc"] - static let commonIRFiles: Set = ["Model.bc"] - static let frameworkIRFiles: Set = ["Framework.bc"] + static let commonIRFiles: Set = ["Model.bc", "Common_vers.bc"] + static let frameworkIRFiles: Set = ["Framework.bc", "Framework_vers.bc"] static let sfSafeSymbolsIRFiles: Set = [ "NSImageExtension.bc", "SFSymbol+1.0.bc", @@ -62,45 +62,18 @@ final class WorkspaceTests: XCTestCase { dumpDependencyGraph: false ) - // Check dependencies made it to the right place + // Check dependencies made it to the right place. All dependencies should be statically + // linked and appear under the .app directory. let appIRPath = context.archive.appending(path: "IR/App.app/") - let commonIRPath = context.archive.appending(path: "IR/Common.framework/") - let frameworkIRPath = context.archive.appending(path: "IR/Framework.framework/") - let sfSafeSymbolsIRPath = context.archive.appending(path: "IR/SFSafeSymbols.framework/") - let appIRPathContents = try FileManager.default.contentsOfDirectory(at: appIRPath, includingPropertiesForKeys: nil) - .reduce(into: Set(), { $0.insert($1.lastPathComponent) }) - let commonIRPathContents = try FileManager.default.contentsOfDirectory(at: commonIRPath, includingPropertiesForKeys: nil) - .reduce(into: Set(), { $0.insert($1.lastPathComponent) }) - let frameworkIRPathContents = try FileManager.default.contentsOfDirectory(at: frameworkIRPath, includingPropertiesForKeys: nil) - .reduce(into: Set(), { $0.insert($1.lastPathComponent) }) - let sfSafeSymbolsIRPathContents = try FileManager.default.contentsOfDirectory(at: sfSafeSymbolsIRPath, includingPropertiesForKeys: nil) - .reduce(into: Set(), { $0.insert($1.lastPathComponent) }) - - let expectedAppIRFiles = Self.appIRFiles + let expectedIRFiles = Self.appIRFiles .union(Self.commonIRFiles) .union(Self.frameworkIRFiles) .union(Self.sfSafeSymbolsIRFiles) - .reduce(into: Set(), { $0.insert($1) }) - let expectedFrameworkIRFiles = Self.frameworkIRFiles - .union(Self.commonIRFiles) - .union(Self.sfSafeSymbolsIRFiles) - .reduce(into: Set(), { $0.insert($1) }) - - let expectedCommonIRFiles = Self.commonIRFiles - .reduce(into: Set(), { $0.insert($1) }) - - let expectedSFSafeSymbolsIRFiles = Self.sfSafeSymbolsIRFiles - .reduce(into: Set(), { $0.insert($1) }) + let appIRPathContents = try FileManager.default.contentsOfDirectory(at: appIRPath, includingPropertiesForKeys: nil) + .reduce(into: Set(), { $0.insert($1.lastPathComponent) }) - XCTAssertEqual(expectedAppIRFiles, appIRPathContents, "App IR expected contents didn't equal actual: \(expectedAppIRFiles.symmetricDifference(appIRPathContents))") - XCTAssertEqual(expectedFrameworkIRFiles, frameworkIRPathContents, "Framework IR expected contents didn't equal actual \(expectedFrameworkIRFiles.symmetricDifference(frameworkIRPathContents))") - XCTAssertEqual(expectedCommonIRFiles, commonIRPathContents, "Common IR expected contents didn't equal actual \(expectedCommonIRFiles.symmetricDifference(commonIRPathContents))") - XCTAssertEqual( - expectedSFSafeSymbolsIRFiles, - sfSafeSymbolsIRPathContents, - "SFSafeSymbols IR expected contents didn't equal actual \(expectedSFSafeSymbolsIRFiles.symmetricDifference(sfSafeSymbolsIRPathContents))" - ) + XCTAssertEqual(expectedIRFiles, appIRPathContents, "App IR expected contents didn't equal actual: \(expectedIRFiles.symmetricDifference(appIRPathContents))") } }