fix(cd): harden zoxide directory suggestions

This commit is contained in:
2026-08-14 13:11:21 +03:00
parent 0b2221d5e9
commit 11fad73ef5
12 changed files with 436 additions and 136 deletions
+17 -1
View File
@@ -173,6 +173,23 @@ func TestLookup_NvimFileGenerator(t *testing.T) {
}
}
func TestQuoteSuggestionArgument(t *testing.T) {
tests := map[string]string{
"/tmp/project": "/tmp/project",
"/tmp/Проект": "/tmp/Проект",
"/tmp/My Project": `'/tmp/My Project'`,
"/tmp/$Project`command`": "'/tmp/$Project`command`'",
`/tmp/quote"and'apostrophe`: "'/tmp/quote\"and'\\''apostrophe'",
"~/My Project": `~/'My Project'`,
}
for input, want := range tests {
if got := quoteSuggestionArgument(input); got != want {
t.Errorf("quoteSuggestionArgument(%q) = %q, want %q", input, got, want)
}
}
}
func TestLookup_OptionAndFilePriority(t *testing.T) {
ResetRegistry()
Register(&Spec{
@@ -389,4 +406,3 @@ func TestLookup_RealGitProvider(t *testing.T) {
t.Errorf("expected 'git recent' in results for real GitProvider, got %v", results)
}
}