From 5ffeade6b8f9c0050e996edcc193aa9fa8f85d84 Mon Sep 17 00:00:00 2001 From: feischl97 Date: Mon, 26 Nov 2018 11:47:08 +0100 Subject: [PATCH] add test info does not override info.plist setting --- .../ProjectGeneratorTests.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift index 3dd7158f..e20bacf5 100644 --- a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift +++ b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift @@ -882,6 +882,24 @@ class ProjectGeneratorTests: XCTestCase { try expect(NSDictionary(dictionary: expectedInfoPlist).isEqual(to: infoPlist)).beTrue() } + + $0.it("info doesn't override info.plist setting") { + let predefinedPlistPath = "Predefined.plist" + // generate plist + let plist = Plist(path: "Info.plist", attributes: ["UISupportedInterfaceOrientations": ["UIInterfaceOrientationPortrait", "UIInterfaceOrientationLandscapeLeft"]]) + let tempPath = Path.temporary + "info" + // create project with a predefined plist + let project = Project(basePath: tempPath, name: "", targets: [Target(name: "", type: .application, platform: .iOS, settings: Settings(buildSettings: ["INFOPLIST_FILE": predefinedPlistPath]), info: plist)]) + let pbxProject = try project.generatePbxProj() + let writer = FileWriter(project: project) + try writer.writePlists() + + guard let targetConfig = pbxProject.nativeTargets.first?.buildConfigurationList?.buildConfigurations.first else { + throw failure("Couldn't find Target config") + } + // generated plist should not be in buildsettings + try expect(targetConfig.buildSettings["INFOPLIST_FILE"] as? String) == predefinedPlistPath + } } } }