╭ changed ─────────╮ │src/test/event.zig│ ╰──────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │10 test "rebase" { │ │11 const io = std.testing.io; │ │12 const allocator = std.testing.allocator; │ │13 - const temp_dir_name = "temp-event-rebase"; │ │13 │ │14 // create the temp dir │ │16 - const cwd = std.Io.Dir.cwd(); │ │17 - var temp_dir_or_err = cwd.openDir(io, temp_dir_name, .{}); │ │18 - if (temp_dir_or_err) |*temp_dir| { │ │19 - temp_dir.close(io); │ │20 - try cwd.deleteTree(io, temp_dir_name); │ │21 - } else |_| {} │ │22 - var temp_dir = try cwd.createDirPathOpen(io, temp_dir_name, .{}); │ │23 - defer cwd.deleteTree(io, temp_dir_name) catch {}; │ │24 - defer temp_dir.close(io); │ │25 - │ │26 - const cwd_path = try std.process.currentPathAlloc(io, allocator); │ │27 - defer allocator.free(cwd_path); │ │15 + var temp = std.testing.tmpDir(.{}); │ │16 + defer temp.cleanup(); │ │17 + const temp_path = try temp.dir.realPathFileAlloc(io, ".", allocator); │ │18 + defer allocator.free(temp_path); │ │19 │ │29 - const work_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name });│ │30 - defer allocator.free(work_path); │ │31 - │ │20 const repo_opts: rp.RepoOpts(.xit) = .{ .is_test = true }; │ │21 const Repo = rp.Repo(.xit, repo_opts); │ │34 - var repo = try Repo.init(io, allocator, .{ .path = work_path }); │ │22 + var repo = try Repo.init(io, allocator, .{ .path = temp_path }); │ │23 defer repo.deinit(io, allocator); │ │24 │ │25 var arena = std.heap.ArenaAllocator.init(allocator); │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────╮ │266 test "merge" { │ │267 const io = std.testing.io; │ │268 const allocator = std.testing.allocator; │ │281 - const temp_dir_name = "temp-event-merge"; │ │269 │ │270 const other_events_ref: rf.Ref = .{ .kind = .head, .name = "haxy/other" };│ │271 │ ╰───────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────╮ │272 // create the temp dir │ │286 - const cwd = std.Io.Dir.cwd(); │ │287 - var temp_dir_or_err = cwd.openDir(io, temp_dir_name, .{}); │ │288 - if (temp_dir_or_err) |*temp_dir| { │ │289 - temp_dir.close(io); │ │290 - try cwd.deleteTree(io, temp_dir_name); │ │291 - } else |_| {} │ │292 - var temp_dir = try cwd.createDirPathOpen(io, temp_dir_name, .{}); │ │293 - defer cwd.deleteTree(io, temp_dir_name) catch {}; │ │294 - defer temp_dir.close(io); │ │295 - │ │296 - const cwd_path = try std.process.currentPathAlloc(io, allocator); │ │297 - defer allocator.free(cwd_path); │ │273 + var temp = std.testing.tmpDir(.{}); │ │274 + defer temp.cleanup(); │ │275 + const temp_path = try temp.dir.realPathFileAlloc(io, ".", allocator); │ │276 + defer allocator.free(temp_path); │ │277 │ │299 - const work_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name });│ │300 - defer allocator.free(work_path); │ │301 - │ │278 const repo_opts: rp.RepoOpts(.xit) = .{ .is_test = true }; │ │279 const Repo = rp.Repo(.xit, repo_opts); │ │304 - var repo = try Repo.init(io, allocator, .{ .path = work_path }); │ │280 + var repo = try Repo.init(io, allocator, .{ .path = temp_path }); │ │281 defer repo.deinit(io, allocator); │ │282 │ │283 var arena = std.heap.ArenaAllocator.init(allocator); │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───────────────╮ │src/test/event/admin.zig│ ╰────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │11 test "user and repo" { │ │12 const io = std.testing.io; │ │13 const allocator = std.testing.allocator; │ │14 - const temp_dir_name = "temp-event-user-and-repo"; │ │14 │ │15 // create the temp dir │ │17 - const cwd = std.Io.Dir.cwd(); │ │18 - var temp_dir_or_err = cwd.openDir(io, temp_dir_name, .{}); │ │19 - if (temp_dir_or_err) |*temp_dir| { │ │20 - temp_dir.close(io); │ │21 - try cwd.deleteTree(io, temp_dir_name); │ │22 - } else |_| {} │ │23 - var temp_dir = try cwd.createDirPathOpen(io, temp_dir_name, .{}); │ │24 - defer cwd.deleteTree(io, temp_dir_name) catch {}; │ │25 - defer temp_dir.close(io); │ │26 - │ │27 - const cwd_path = try std.process.currentPathAlloc(io, allocator); │ │28 - defer allocator.free(cwd_path); │ │16 + var temp = std.testing.tmpDir(.{}); │ │17 + defer temp.cleanup(); │ │18 + const temp_path = try temp.dir.realPathFileAlloc(io, ".", allocator); │ │19 + defer allocator.free(temp_path); │ │20 │ │30 - const work_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name });│ │31 - defer allocator.free(work_path); │ │32 - │ │21 const repo_opts: rp.RepoOpts(.xit) = .{ .is_test = true }; │ │22 const Repo = rp.Repo(.xit, repo_opts); │ │35 - var repo = try Repo.init(io, allocator, .{ .path = work_path }); │ │23 + var repo = try Repo.init(io, allocator, .{ .path = temp_path }); │ │24 defer repo.deinit(io, allocator); │ │25 │ │26 var arena = std.heap.ArenaAllocator.init(allocator); │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────╮ │222 test "repos and users paginate newest first" { │ │223 const io = std.testing.io; │ │224 const allocator = std.testing.allocator; │ │237 - const temp_dir_name = "temp-event-order"; │ │225 │ │239 - const cwd = std.Io.Dir.cwd(); │ │240 - var temp_dir_or_err = cwd.openDir(io, temp_dir_name, .{}); │ │241 - if (temp_dir_or_err) |*temp_dir| { │ │242 - temp_dir.close(io); │ │243 - try cwd.deleteTree(io, temp_dir_name); │ │244 - } else |_| {} │ │245 - var temp_dir = try cwd.createDirPathOpen(io, temp_dir_name, .{}); │ │246 - defer cwd.deleteTree(io, temp_dir_name) catch {}; │ │247 - defer temp_dir.close(io); │ │248 - │ │249 - const cwd_path = try std.process.currentPathAlloc(io, allocator); │ │250 - defer allocator.free(cwd_path); │ │251 - const work_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name });│ │252 - defer allocator.free(work_path); │ │226 + var temp = std.testing.tmpDir(.{}); │ │227 + defer temp.cleanup(); │ │228 + const temp_path = try temp.dir.realPathFileAlloc(io, ".", allocator); │ │229 + defer allocator.free(temp_path); │ │230 │ │231 const repo_opts: rp.RepoOpts(.xit) = .{ .is_test = true }; │ │232 const Repo = rp.Repo(.xit, repo_opts); │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────╮ │256 - var repo = try Repo.init(io, allocator, .{ .path = work_path });│ │233 + var repo = try Repo.init(io, allocator, .{ .path = temp_path });│ │234 defer repo.deinit(io, allocator); │ │235 │ │236 var arena = std.heap.ArenaAllocator.init(allocator); │ ╰─────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │316 test "fork query and removal lifecycle" { │ │317 const io = std.testing.io; │ │318 const allocator = std.testing.allocator; │ │342 - const temp_dir_name = "temp-fork-event"; │ │343 - const cwd = std.Io.Dir.cwd(); │ │319 │ │345 - if (cwd.openDir(io, temp_dir_name, .{})) |dir_value| { │ │346 - var dir = dir_value; │ │347 - dir.close(io); │ │348 - try cwd.deleteTree(io, temp_dir_name); │ │349 - } else |_| {} │ │350 - var temp_dir = try cwd.createDirPathOpen(io, temp_dir_name, .{}); │ │351 - defer cwd.deleteTree(io, temp_dir_name) catch {}; │ │352 - defer temp_dir.close(io); │ │320 + var temp = std.testing.tmpDir(.{}); │ │321 + defer temp.cleanup(); │ │322 + const temp_path = try temp.dir.realPathFileAlloc(io, ".", allocator); │ │323 + defer allocator.free(temp_path); │ │324 │ │354 - const cwd_path = try std.process.currentPathAlloc(io, allocator); │ │355 - defer allocator.free(cwd_path); │ │356 - const root = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name }); │ │357 - defer allocator.free(root); │ │358 - const repos_dir = try std.fs.path.join(allocator, &.{ root, "repos" }); │ │325 + const repos_dir = try std.fs.path.join(allocator, &.{ temp_path, "repos" }); │ │326 defer allocator.free(repos_dir); │ │360 - const admin_path = try std.fs.path.join(allocator, &.{ root, "admin" }); │ │327 + const admin_path = try std.fs.path.join(allocator, &.{ temp_path, "admin" });│ │328 defer allocator.free(admin_path); │ │329 │ │330 var prng = std.Random.DefaultPrng.init(std.testing.random_seed); │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───────────────╮ │src/test/event/patch.zig│ ╰────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │67 test "patch event conflicts, stacking, and gc" { │ │68 const io = std.testing.io; │ │69 const allocator = std.testing.allocator; │ │70 - const temp_dir_name = "temp-event-patch"; │ │71 - const cwd = std.Io.Dir.cwd(); │ │70 │ │71 // create the temp dir │ │74 - if (cwd.openDir(io, temp_dir_name, .{})) |dir_value| { │ │75 - var dir = dir_value; │ │76 - dir.close(io); │ │77 - try cwd.deleteTree(io, temp_dir_name); │ │78 - } else |_| {} │ │79 - var temp_dir = try cwd.createDirPathOpen(io, temp_dir_name, .{}); │ │80 - defer cwd.deleteTree(io, temp_dir_name) catch {}; │ │81 - defer temp_dir.close(io); │ │72 + var temp = std.testing.tmpDir(.{}); │ │73 + defer temp.cleanup(); │ │74 + const temp_path = try temp.dir.realPathFileAlloc(io, ".", allocator); │ │75 + defer allocator.free(temp_path); │ │76 │ │83 - const cwd_path = try std.process.currentPathAlloc(io, allocator); │ │84 - defer allocator.free(cwd_path); │ │85 - const upstream_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "upstream" });│ │77 + const upstream_path = try std.fs.path.join(allocator, &.{ temp_path, "upstream" }); │ │78 defer allocator.free(upstream_path); │ │87 - const target_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "target" }); │ │79 + const target_path = try std.fs.path.join(allocator, &.{ temp_path, "target" }); │ │80 defer allocator.free(target_path); │ │89 - const source_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "source" }); │ │81 + const source_path = try std.fs.path.join(allocator, &.{ temp_path, "source" }); │ │82 defer allocator.free(source_path); │ │83 │ │84 // │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────╮ │480 } │ │481 │ │482 test "patch lifecycle" { │ │491 - try patchLifecycle("temp-patch-lifecycle-squash", .squash); │ │492 - try patchLifecycle("temp-patch-lifecycle-source", .source); │ │483 + try patchLifecycle(.squash); │ │484 + try patchLifecycle(.source); │ │485 } │ │486 │ │495 -fn patchLifecycle(temp_dir_name: []const u8, merge_revision: pch.MergeRevision) !void {│ │487 +fn patchLifecycle(merge_revision: pch.MergeRevision) !void { │ │488 const io = std.testing.io; │ │489 const allocator = std.testing.allocator; │ │498 - const cwd = std.Io.Dir.cwd(); │ │490 │ │500 - if (cwd.openDir(io, temp_dir_name, .{})) |dir_value| { │ │501 - var dir = dir_value; │ │502 - dir.close(io); │ │503 - try cwd.deleteTree(io, temp_dir_name); │ │504 - } else |_| {} │ │505 - var temp_dir = try cwd.createDirPathOpen(io, temp_dir_name, .{}); │ │506 - defer cwd.deleteTree(io, temp_dir_name) catch {}; │ │507 - defer temp_dir.close(io); │ │491 + var temp = std.testing.tmpDir(.{}); │ │492 + defer temp.cleanup(); │ │493 + const temp_path = try temp.dir.realPathFileAlloc(io, ".", allocator); │ │494 + defer allocator.free(temp_path); │ │495 │ │509 - const cwd_path = try std.process.currentPathAlloc(io, allocator); │ │510 - defer allocator.free(cwd_path); │ │511 - const root = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name }); │ │512 - defer allocator.free(root); │ │513 - const repos_dir = try std.fs.path.join(allocator, &.{ root, "repos" }); │ │496 + const repos_dir = try std.fs.path.join(allocator, &.{ temp_path, "repos" }); │ │497 defer allocator.free(repos_dir); │ │515 - const admin_path = try std.fs.path.join(allocator, &.{ root, "admin" }); │ │498 + const admin_path = try std.fs.path.join(allocator, &.{ temp_path, "admin" }); │ │499 defer allocator.free(admin_path); │ │517 - const upstream_path = try std.fs.path.join(allocator, &.{ root, "upstream" }); │ │500 + const upstream_path = try std.fs.path.join(allocator, &.{ temp_path, "upstream" });│ │501 defer allocator.free(upstream_path); │ │519 - const source_path = try std.fs.path.join(allocator, &.{ root, "source" }); │ │502 + const source_path = try std.fs.path.join(allocator, &.{ temp_path, "source" }); │ │503 defer allocator.free(source_path); │ │504 │ │505 var prng = std.Random.DefaultPrng.init(std.testing.random_seed); │ ╰────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───────╮ │src/test/net.zig│ ╰────────────────╯ ╭───────────────────────────────────────────╮ │89 fn runServer( │ │90 io: std.Io, │ │91 allocator: std.mem.Allocator, │ │92 - comptime temp_dir_name: []const u8,│ │92 + temp_path: []const u8, │ │93 comptime port: u16, │ │94 ) !std.process.Child { │ │95 { │ ╰───────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯