From 16a02fa1a68ccf0eb9673bb429ba993fdd1f6a4c Mon Sep 17 00:00:00 2001 From: Ell Neal Date: Thu, 24 Jan 2019 13:47:21 +0000 Subject: [PATCH] Add tests for legacy path behavior --- Tests/Fixtures/legacy_paths_test.yml | 4 ++ .../legacy_included_paths_test.yml | 33 ++++++++++++++++ Tests/XcodeGenKitTests/SpecLoadingTests.swift | 39 +++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 Tests/Fixtures/legacy_paths_test.yml create mode 100644 Tests/Fixtures/legacy_paths_test/legacy_included_paths_test.yml diff --git a/Tests/Fixtures/legacy_paths_test.yml b/Tests/Fixtures/legacy_paths_test.yml new file mode 100644 index 00000000..50b40b1b --- /dev/null +++ b/Tests/Fixtures/legacy_paths_test.yml @@ -0,0 +1,4 @@ +include: + path: legacy_paths_test/legacy_included_paths_test.yml + useRelativePaths: false +name: NewName diff --git a/Tests/Fixtures/legacy_paths_test/legacy_included_paths_test.yml b/Tests/Fixtures/legacy_paths_test/legacy_included_paths_test.yml new file mode 100644 index 00000000..de8cce3c --- /dev/null +++ b/Tests/Fixtures/legacy_paths_test/legacy_included_paths_test.yml @@ -0,0 +1,33 @@ +configFiles: + IncludedConfig: config +options: + carthageBuildPath: carthage_build + carthageExecutablePath: carthage_executable +targets: + IncludedTarget: + type: application + platform: tvOS + configFiles: + Config: config + sources: + - source + dependencies: + - framework: Framework + info: + path: info + entitlements: + path: entitlements + preBuildScripts: + - path: preBuildScript + postCompileScripts: + - path: postCompileScript + postBuildScripts: + - path: postBuildScript +aggregateTargets: + IncludedAggregateTarget: + targets: + - IncludedTarget + configFiles: + Config: config + buildScripts: + - path: buildScript diff --git a/Tests/XcodeGenKitTests/SpecLoadingTests.swift b/Tests/XcodeGenKitTests/SpecLoadingTests.swift index 270d14cf..a2048c8b 100644 --- a/Tests/XcodeGenKitTests/SpecLoadingTests.swift +++ b/Tests/XcodeGenKitTests/SpecLoadingTests.swift @@ -105,6 +105,45 @@ class SpecLoadingTests: XCTestCase { ] } + $0.it("respects directory expansion preference") { + let path = fixturePath + "legacy_paths_test.yml" + let project = try Project(path: path) + + try expect(project.configFiles) == [ + "IncludedConfig": "config", + ] + + try expect(project.options) == SpecOptions( + carthageBuildPath: "carthage_build", + carthageExecutablePath: "carthage_executable" + ) + + try expect(project.aggregateTargets) == [ + AggregateTarget( + name: "IncludedAggregateTarget", + targets: ["IncludedTarget"], + configFiles: ["Config": "config"], + buildScripts: [BuildScript(script: .path("buildScript"))] + ), + ] + + try expect(project.targets) == [ + Target( + name: "IncludedTarget", + type: .application, + platform: .tvOS, + configFiles: ["Config": "config"], + sources: ["source"], + dependencies: [Dependency(type: .framework, reference: "Framework")], + info: Plist(path: "info"), + entitlements: Plist(path: "entitlements"), + preBuildScripts: [BuildScript(script: .path("preBuildScript"))], + postCompileScripts: [BuildScript(script: .path("postCompileScript"))], + postBuildScripts: [BuildScript(script: .path("postBuildScript"))] + ), + ] + } + $0.it("parses yaml types") { let path = fixturePath + "yaml.yml" let dictionary = try loadYamlDictionary(path: path)