From d3b096a5252b3d2290c0d056080ec8db705809e5 Mon Sep 17 00:00:00 2001 From: Tom Quist Date: Wed, 19 Jun 2019 22:32:01 +0200 Subject: [PATCH] Add additional spec for variable expension in combination with template attributes --- Tests/Fixtures/env_test.yml | 5 ----- Tests/Fixtures/variables_test.yml | 20 +++++++++++++++++++ Tests/XcodeGenKitTests/SpecLoadingTests.swift | 13 ++++++++---- 3 files changed, 29 insertions(+), 9 deletions(-) delete mode 100644 Tests/Fixtures/env_test.yml create mode 100644 Tests/Fixtures/variables_test.yml diff --git a/Tests/Fixtures/env_test.yml b/Tests/Fixtures/env_test.yml deleted file mode 100644 index eddd4f51..00000000 --- a/Tests/Fixtures/env_test.yml +++ /dev/null @@ -1,5 +0,0 @@ -include: [included.yml] -name: NewName -settingGroups: - test: - MY_SETTING1: ${SETTING1} diff --git a/Tests/Fixtures/variables_test.yml b/Tests/Fixtures/variables_test.yml new file mode 100644 index 00000000..0354051a --- /dev/null +++ b/Tests/Fixtures/variables_test.yml @@ -0,0 +1,20 @@ +include: [included.yml] +name: NewName +settingGroups: + test: + MY_SETTING1: ${SETTING1} +targets: + SomeTarget: + type: framework + platform: iOS + templates: + - Variables + templateAttributes: + templateVariable: templateVariable + variable: doesNotWin +targetTemplates: + Variables: + sources: + - ${target_name} + - ${variable} + - ${templateVariable} diff --git a/Tests/XcodeGenKitTests/SpecLoadingTests.swift b/Tests/XcodeGenKitTests/SpecLoadingTests.swift index cb62451d..fcad2191 100644 --- a/Tests/XcodeGenKitTests/SpecLoadingTests.swift +++ b/Tests/XcodeGenKitTests/SpecLoadingTests.swift @@ -187,15 +187,20 @@ class SpecLoadingTests: XCTestCase { } } - $0.it("expands environment variables") { - let path = fixturePath + "env_test.yml" - let project = try loadSpec(path: path, variables: ["SETTING1": "ENV VALUE1", "SETTING4": "ENV VALUE4"]) + $0.it("expands variables") { + let path = fixturePath + "variables_test.yml" + let project = try loadSpec(path: path, variables: [ + "SETTING1": "ENV VALUE1", + "SETTING4": "ENV VALUE4", + "variable": "doesWin" + ]) try expect(project.name) == "NewName" try expect(project.settingGroups) == [ - "test": Settings(dictionary: ["MY_SETTING1": "ENV VALUE1", "MY_SETTING2": "VALUE2", "MY_SETTING4": "ENV VALUE4"]), + "test": Settings(dictionary: ["MY_SETTING1": "ENV VALUE1", "MY_SETTING2": "VALUE2", "MY_SETTING4": "ENV VALUE4"]), "toReplace": Settings(dictionary: ["MY_SETTING1": "VALUE1"]), ] + try expect(project.targets.last?.sources) == ["SomeTarget", "doesWin", "templateVariable"] } } }