Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Tests/PodToBUILDTests/PodStoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down