From 6a8095421e8e2c3bf1d4bfc4aac0a5cd4f07ebaf Mon Sep 17 00:00:00 2001 From: wizzy-yang <244719629+wizzy-yang@users.noreply.github.com> Date: Thu, 8 Oct 2026 13:34:23 +0800 Subject: [PATCH] sessions tests: TestCursor expects the resume command Windows gives it (red on Windows in main since 585f7f7d) (#1248) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 585f7f7d made resumeCommand put a `Set-Location -LiteralPath ''; ` in front of a session's command on Windows, and updated the tests that assert one: TestCarryPiToOmp (transcript_test.go:168) expects the Set-Location form there. TestCursor's own assertion was left behind. It builds `want` for a Cursor chat run under /work/cur, and its Windows branch only skips the `cd` prefix rather than taking the one Windows uses, so on Windows the test asserts the bare `cursor-agent --resume ` while the code returns the prefixed one: cursor_test.go:254: resume "Set-Location -LiteralPath '/work/cur'; cursor-agent --resume 6f0c…", want "cursor-agent --resume 6f0c…" Nothing about Cursor is wrong: the Sessions page copies that command for the user to paste into their shell (sessions.js's copy of `s.resume`), and on Windows `Set-Location` is the right form for it, as wslResume's comment already says of the distro variant ("the PowerShell line that resumes a session"). The test was simply not carried over with the rest, and CI never sees it — test.yml runs `go test` only where `runner.os != 'Windows'` (test.yml:67), Windows gets `go test -run '^$'` to compile. The assertion now takes the Set-Location prefix on Windows, as TestCarryPiToOmp does. No production change. TestCursor passes on Windows here and the whole internal/sessions package is ok (20.5s). It is a real check, not a mirror of the code: with resumeCommand's Windows branch made to return the bare command, the test goes red naming the missing prefix, and green again when restored. go vet and gofmt (on LF content; this clone has core.autocrlf=true and no .gitattributes, so gofmt -l flags every file) are clean. Not run on Linux or macOS, where the branch is the `cd … && …` form already covered. Co-authored-by: wizzy-yang --- internal/sessions/cursor_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/sessions/cursor_test.go b/internal/sessions/cursor_test.go index c8a38199f..f8dc07bb5 100644 --- a/internal/sessions/cursor_test.go +++ b/internal/sessions/cursor_test.go @@ -249,6 +249,10 @@ func TestCursor(t *testing.T) { want := "cursor-agent --resume " + curMain if runtime.GOOS != "windows" { want = "cd '/work/cur' && " + want + } else { + // the same prefix every other resume here gets on Windows + // (sessions.go's resumeCommand), as TestCarryPiToOmp expects + want = "Set-Location -LiteralPath '/work/cur'; " + want } if s.Resume != want { t.Fatalf("resume %q, want %q", s.Resume, want)