diff --git a/Tests/PodToBUILDTests/PodStoreTests.swift b/Tests/PodToBUILDTests/PodStoreTests.swift index 8fc981f0..6e3bcd05 100644 --- a/Tests/PodToBUILDTests/PodStoreTests.swift +++ b/Tests/PodToBUILDTests/PodStoreTests.swift @@ -76,6 +76,39 @@ class PodStoreTests: XCTestCase { XCTAssertTrue(shell.executed(encodedCommand: extract.0)) } + func testZipExtractionWithSpecialCharacteres() { + + let fileName = "v4.0.1.zip" + let urlString = "https://github.com/danielgindi/Charts/archive/refs/tags/" + fileName + let nameOfPod = "Charts" + + let fetchOptionsCharts = FetchOptions(podName: nameOfPod, + url: urlString, + trace: false, + subDir: nil) + + let downloadPathCharts = "%TMP%/" + nameOfPod + "-" + fileName + + let hasDir = MakeShellInvocation("/bin/[", arguments: ["-e", + cacheRoot(forPod: nameOfPod, url: urlString), + "]"], exitCode: 1) + + let extract = MakeShellInvocation("/bin/sh", + arguments: ["-c", RepoActions.unzipTransaction( + rootDir: escape(extractDir), + fileName: escape(downloadPathCharts) + )], + exitCode: 0) + let shell = LogicalShellContext(commandInvocations: [ + hasDir, + extract + ]) + + RepoActions.fetch(shell: shell, fetchOptions: fetchOptionsCharts) + XCTAssertTrue(shell.executed(encodedCommand:LogicalShellContext.encodeDownload(url: URL(string: fetchOptionsCharts.url)!, toFile: downloadPathCharts))) + XCTAssertTrue(shell.executed(encodedCommand: extract.0)) + } + func testCachedDownload() { let hasDir = MakeShellInvocation("/bin/[", arguments: ["-e", cacheRoot(forPod: testPodName, url: "http://pinner.com/foo.zip"), "]"], value: 0) let shell = LogicalShellContext(commandInvocations: [