Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Windows path tests: POSIX half off Windows; companion fixture is an .exe

justrachfa3c0cf5a712
diff --git a/src/path_lookup.zig b/src/path_lookup.zig
index b7768049..5ba94aac 100644
--- a/src/path_lookup.zig
+++ b/src/path_lookup.zig
@@ -57,11 +57,13 @@ test "resolveWith splits on the platform delimiter and tries Windows extensions"
try tmp.dir.writeFile(io, .{ .sub_path = "win/codedb.exe", .data = "" });
var buf: [1024]u8 = undefined;
- // POSIX: ':' separated, the bare name.
- const posix = try std.fmt.allocPrint(a, "{s}/missing:{s}:{s}/bin", .{ root, root, root });
- defer a.free(posix);
- const p = resolveWith(io, posix, ':', &.{}, "codedb", &buf) orelse return error.TestExpectedResolve;
- try std.testing.expect(std.mem.endsWith(u8, p, "bin/codedb"));
+ // POSIX: ':' separated, the bare name. (Windows temp paths hold a drive colon.)
+ if (builtin.os.tag != .windows) {
+ const posix = try std.fmt.allocPrint(a, "{s}/missing:{s}:{s}/bin", .{ root, root, root });
+ defer a.free(posix);
+ const p = resolveWith(io, posix, ':', &.{}, "codedb", &buf) orelse return error.TestExpectedResolve;
+ try std.testing.expect(std.mem.endsWith(u8, p, "bin/codedb"));
+ }
// Windows: ';' separated (each entry may hold a colon), quoted entries, and `.exe` found for a bare name.
const win = try std.fmt.allocPrint(a, "{s}/missing;\"{s}/win\"", .{ root, root });
@@ -72,6 +74,6 @@ test "resolveWith splits on the platform delimiter and tries Windows extensions"
try std.testing.expect(resolveWith(io, win, ';', &windows_exts, "codedb.exe", &buf) != null);
// Splitting a ';' PATH on ':' (the old bug) finds nothing.
- try std.testing.expect(resolveWith(io, win, ':', &windows_exts, "codedb", &buf) == null);
+ if (builtin.os.tag != .windows) try std.testing.expect(resolveWith(io, win, ':', &windows_exts, "codedb", &buf) == null);
try std.testing.expect(resolveWith(io, "", ':', &.{}, "codedb", &buf) == null);
}
diff --git a/src/session_connect_tests.zig b/src/session_connect_tests.zig
index f30a620e..1bfd16df 100644
--- a/src/session_connect_tests.zig
+++ b/src/session_connect_tests.zig
@@ -52,7 +52,8 @@ test "connectCompanion yolo writes the companion receipt and does not addServer"
// A plain file satisfies binOnPath's access() probe. A symlink to
// /bin/false does not on every host: access() follows the link, and newer
// macOS ships only /usr/bin/false.
- (try tmp.dir.createFile(io, "codedb-pro", .{})).close(io);
+ // Windows finds programs by their extension, as a real install would have it.
+ (try tmp.dir.createFile(io, if (@import("builtin").os.tag == .windows) "codedb-pro.exe" else "codedb-pro", .{})).close(io);
var path_buf: [std.fs.max_path_bytes]u8 = undefined;
const n = try tmp.dir.realPath(io, &path_buf);
const saved_path = main_mod.g_path_env;