╭ changed ─────────╮ │src/test/event.zig│ ╰──────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │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); │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯