summaryrefslogtreecommitdiff
path: root/test/session.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/session.zig')
-rw-r--r--test/session.zig10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/session.zig b/test/session.zig
index 136d34d1..fd956aa9 100644
--- a/test/session.zig
+++ b/test/session.zig
@@ -90,9 +90,13 @@ pub const Session = struct {
/// A session showing a scratch pane, keeping its state in the state
/// file in `dir` (its DumpDir), as every session of a user shares one.
pub fn initShared(gpa: std.mem.Allocator, dir: []const u8) !Session {
- var config: [4200]u8 = undefined;
- const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24, .state = .disk, .startup_config = try std.fmt.bufPrint(&config, "DumpDir {s}\n", .{dir}) });
- var s: Session = .{ .core = p, .arena = .init(gpa) };
+ // The core keeps the config's slice (a Restore applies it again):
+ // the session's arena owns it, not this frame.
+ var arena: std.heap.ArenaAllocator = .init(gpa);
+ errdefer arena.deinit();
+ const config = try std.fmt.allocPrint(arena.allocator(), "DumpDir {s}\n", .{dir});
+ const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24, .state = .disk, .startup_config = config });
+ var s: Session = .{ .core = p, .arena = arena };
s.drain();
return s;
}