import Foundation import Testing @testable import PackLib @Test func cfBundleSupportedPlatformsFollowsBuildTriple() { #expect(Packer.cfBundleSupportedPlatforms(for: "arm64-apple-ios") == ["iPhoneOS"]) #expect(Packer.cfBundleSupportedPlatforms(for: "arm64-apple-ios-simulator") == ["iPhoneSimulator"]) #expect(Packer.cfBundleSupportedPlatforms(for: "arm64-apple-ios17.0") == ["iPhoneOS"]) #expect(Packer.cfBundleSupportedPlatforms(for: "arm64-apple-ios17.0-simulator") == ["iPhoneSimulator"]) #expect(Packer.cfBundleSupportedPlatforms(for: "x86_64-apple-ios-simulator") == ["iPhoneSimulator"]) #expect(Packer.cfBundleSupportedPlatforms(for: "arm64-apple-macosx") == ["MacOSX"]) #expect(Packer.cfBundleSupportedPlatforms(for: "x86_64-apple-macosx") == ["MacOSX"]) #expect(Packer.cfBundleSupportedPlatforms(for: "unknown-triple") == ["iPhoneOS"]) } @Test func compiledAssetFileNamesExcludesSidecarsAndPartialPlist() throws { let dir = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true) defer { try? FileManager.default.removeItem(at: dir) } for name in ["Assets.car", "AppIcon60x60@2x.png", "Assets.xcassets.sha256", "assets-partial-Info.plist"] { try Data().write(to: dir.appendingPathComponent(name)) } #expect(try Packer.compiledAssetFileNames(in: dir) == ["AppIcon60x60@2x.png", "Assets.car"]) #expect(throws: (any Error).self) { try Packer.compiledAssetFileNames(in: dir.appendingPathComponent("missing")) } } @Test func packSchemaDecodesAssetCatalogCompiledDir() throws { let base = try YAMLTestDecode() #expect(base.assetCatalog?.compiledDir == "Resources") } private func YAMLTestDecode() throws -> PackSchemaBase { // Exercises the same Codable shape xtool.yml uses in Modern-Apps. let json = #"{"version":1,"bundleID":"cc.findfamily.app.1","assetCatalog":{"compiledDir":"Resources"}}"# return try JSONDecoder().decode(PackSchemaBase.self, from: Data(json.utf8)) }