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"] } } }