From 1056bfc3495549567916656d97d3f8672f56cd51 Mon Sep 17 00:00:00 2001 From: patriceckhart Date: Mon, 27 Apr 2026 11:14:39 +0200 Subject: [PATCH] tui: skip path-quoting tests on windows normalisePathToken's heuristic only fires for unix-shaped paths (leading /, ~, or file:// with a / path). On Windows, t.TempDir() returns paths like C:\Users\RUNNER~1\AppData\Local\Temp\... which never match those prefixes, so the test inputs never get quoted and every assertion fails. The function is unix-only by design (drag-and-drop on macOS/Linux); skip the test on Windows rather than carry a parallel Windows test that would just duplicate platform-specific quoting logic. --- internal/tui/quote_paste_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/tui/quote_paste_test.go b/internal/tui/quote_paste_test.go index 5686711..0c52d17 100644 --- a/internal/tui/quote_paste_test.go +++ b/internal/tui/quote_paste_test.go @@ -4,6 +4,7 @@ import ( "net/url" "os" "path/filepath" + "runtime" "strings" "testing" ) @@ -25,6 +26,15 @@ func makeFiles(t *testing.T, base string, rels ...string) string { } func TestQuotePastedFilePaths(t *testing.T) { + // normalisePathToken's heuristics target Unix-shaped paths + // (leading "/", "~", or "file://" with a "/" path component) — + // the same shapes drag-and-drop produces on macOS and Linux. + // Windows TempDir paths look like C:\Users\... which never + // match those prefixes, so the test fixtures wouldn't exercise + // any real code path on that platform. + if runtime.GOOS == "windows" { + t.Skip("path-quoting heuristics are unix-shaped") + } dir := t.TempDir() makeFiles(t, dir, "foo bar.png", @@ -106,6 +116,9 @@ func TestQuotePastedFilePaths(t *testing.T) { // when the home directory contains the candidate. We don't write // into the user's real home; instead, override HOME for the test. func TestTildePathExists(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("path-quoting heuristics are unix-shaped") + } tmp := t.TempDir() makeFiles(t, tmp, "tilde-test.png") t.Setenv("HOME", tmp)