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