native macOS codings agent orchestrator prowl.onev.cat
Something went wrong. Try again.
2.1 kB · 63 lines
Swift
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364import Foundationimport Testing
@testable import supacode
actor DiffPathShellCallStore { private(set) var calls: [[String]] = []
func record(_ arguments: [String]) { calls.append(arguments) }}
struct GitClientDiffPathEncodingTests { @Test func diffNameStatusDisablesQuotePath() async { let store = DiffPathShellCallStore() let shell = ShellClient( run: { _, arguments, _ in await store.record(arguments) return ShellOutput(stdout: "M\t中文文件.md\n", stderr: "", exitCode: 0) }, runLoginImpl: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } ) let client = GitClient(shell: shell, resolveGit: { _ in .testExecutable })
let output = await client.diffNameStatus(at: URL(fileURLWithPath: "/tmp/repo"))
#expect(output.contains("中文文件.md")) let calls = await store.calls #expect(calls.count == 1) let args = calls[0] #expect(args.contains("/usr/bin/git")) #expect(args.contains("-c")) #expect(args.contains("core.quotePath=false")) #expect(args.contains("diff")) #expect(args.contains("--name-status")) }
@Test func untrackedFilePathsDisablesQuotePath() async { let store = DiffPathShellCallStore() let shell = ShellClient( run: { _, arguments, _ in await store.record(arguments) return ShellOutput(stdout: "中文文件.md\n", stderr: "", exitCode: 0) }, runLoginImpl: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } ) let client = GitClient(shell: shell, resolveGit: { _ in .testExecutable })
let paths = await client.untrackedFilePaths(at: URL(fileURLWithPath: "/tmp/repo"))
#expect(paths == ["中文文件.md"]) let calls = await store.calls #expect(calls.count == 1) let args = calls[0] #expect(args.contains("/usr/bin/git")) #expect(args.contains("-c")) #expect(args.contains("core.quotePath=false")) #expect(args.contains("ls-files")) #expect(args.contains("--others")) #expect(args.contains("--exclude-standard")) }}