sessions tests: TestCursor expects the resume command Windows gives it (red on Windows in main since 585f7f7d) (#1248)

585f7f7d made resumeCommand put a `Set-Location -LiteralPath '<cwd>'; ` 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 <id>` 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 <wizzy-yang@users.noreply.github.com>
This commit is contained in:
wizzy-yang
2026-10-08 13:34:23 +08:00
committed by GitHub
co-authored by wizzy-yang
parent 1ab6228b22
commit 6a8095421e
+4
View File
@@ -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)