From d12bd0a426322bb751e1feecef8bcc8e3e4dfcae Mon Sep 17 00:00:00 2001 From: Steven Roebert Date: Sun, 7 Apr 2019 13:05:01 +0200 Subject: [PATCH] Added unit test for testing the flattening of relative paths #(550) --- .../SourceGeneratorTests.swift | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Tests/XcodeGenKitTests/SourceGeneratorTests.swift b/Tests/XcodeGenKitTests/SourceGeneratorTests.swift index 68eec0ce..0e718f75 100644 --- a/Tests/XcodeGenKitTests/SourceGeneratorTests.swift +++ b/Tests/XcodeGenKitTests/SourceGeneratorTests.swift @@ -613,6 +613,37 @@ class SourceGeneratorTests: XCTestCase { let project = Project(basePath: directoryPath, name: "Test", targets: [target]) _ = try project.generatePbxProj() } + + $0.it("relative path items outside base path are grouped together") { + let directories = """ + Sources: + - Inside: + - a.swift + - Inside2: + - b.swift + """ + try createDirectories(directories) + + let outOfSourceFile1 = outOfRootPath + "Outside/a.swift" + try outOfSourceFile1.parent().mkpath() + try outOfSourceFile1.write("") + + let outOfSourceFile2 = outOfRootPath + "Outside/Outside2/b.swift" + try outOfSourceFile2.parent().mkpath() + try outOfSourceFile2.write("") + + let target = Target(name: "Test", type: .application, platform: .iOS, sources: [ + "Sources", + "../OtherDirectory", + ]) + let project = Project(basePath: directoryPath, name: "Test", targets: [target]) + + let pbxProj = try project.generatePbxProj() + try pbxProj.expectFile(paths: ["Sources", "Inside", "a.swift"], buildPhase: .sources) + try pbxProj.expectFile(paths: ["Sources", "Inside", "Inside2", "b.swift"], buildPhase: .sources) + try pbxProj.expectFile(paths: ["../OtherDirectory", "Outside", "a.swift"], names: ["OtherDirectory", "Outside", "a.swift"], buildPhase: .sources) + try pbxProj.expectFile(paths: ["../OtherDirectory", "Outside", "Outside2", "b.swift"], names: ["OtherDirectory", "Outside", "Outside2", "b.swift"], buildPhase: .sources) + } } } }