Ver código fonte

test(acp): make shell workdir location assertion windows-safe (#32306)

Shoubhit Dash 2 meses atrás
pai
commit
e4d4b07e7d
1 arquivos alterados com 3 adições e 1 exclusões
  1. 3 1
      packages/opencode/test/acp/tool.test.ts

+ 3 - 1
packages/opencode/test/acp/tool.test.ts

@@ -1,3 +1,4 @@
+import { resolve } from "path"
 import { describe, expect, test } from "bun:test"
 import { describe, expect, test } from "bun:test"
 import {
 import {
   completedToolContent,
   completedToolContent,
@@ -38,8 +39,9 @@ describe("acp tool conversion", () => {
       { path: "/tmp/outside" },
       { path: "/tmp/outside" },
     ])
     ])
     expect(toLocations("bash", { cmd: "pwd" }, "/workspace")).toEqual([{ path: "/workspace" }])
     expect(toLocations("bash", { cmd: "pwd" }, "/workspace")).toEqual([{ path: "/workspace" }])
+    // Relative workdir resolves against cwd via the platform path resolver (backslashes on Windows).
     expect(toLocations("bash", { command: "pwd", workdir: "subdir" }, "/workspace")).toEqual([
     expect(toLocations("bash", { command: "pwd", workdir: "subdir" }, "/workspace")).toEqual([
-      { path: "/workspace/subdir" },
+      { path: resolve("/workspace", "subdir") },
     ])
     ])
     expect(toLocations("bash", { command: "pwd", workdir: "/abs/dir" }, "/workspace")).toEqual([{ path: "/abs/dir" }])
     expect(toLocations("bash", { command: "pwd", workdir: "/abs/dir" }, "/workspace")).toEqual([{ path: "/abs/dir" }])
     expect(toLocations("bash", { command: "printf hello" })).toEqual([])
     expect(toLocations("bash", { command: "printf hello" })).toEqual([])