summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-21 17:25:52 -0300
committerGabriel Schneider <[email protected]>2026-10-22 10:03:15 -0300
commit23518c9d7c061f8a06f6632da8b64b37801b514f (patch)
tree1f9688a5c2b2c224f47dd538ffab275b1f54da5c /src/ninep/ctl.zig
parentbc3d18d27f9fc1155db7fac3946c4d38774f9e65 (diff)
downloadpardes-23518c9d7c061f8a06f6632da8b64b37801b514f.tar.gz
pardes-23518c9d7c061f8a06f6632da8b64b37801b514f.zip
zig fmt for Zig 0.17
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig168
1 files changed, 84 insertions, 84 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 6b4bbafb..3e7c367b 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -1277,15 +1277,15 @@ const withFile = th.withFile;
const serialOf = th.serialOf;
const Node = tree.Node;
const Status = tree.Status;
-const root_status = @intFromEnum(tree.TopFile.status);
-const root_look = @intFromEnum(tree.TopFile.look);
-const root_exec = @intFromEnum(tree.TopFile.exec);
+const root_status = @backingInt(tree.TopFile.status);
+const root_look = @backingInt(tree.TopFile.look);
+const root_exec = @backingInt(tree.TopFile.exec);
test "a control character in a write to any ctl refuses the whole write, and a quoted line shows a tab as a blank" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
const col = layout.columnSerial(p, 0);
- for ([_]u64{ @intFromEnum(tree.TopFile.ctl), Node.of(serialOf(p), .ctl), Node.ofCol(col, .ctl) }) |node| {
+ for ([_]u64{ @backingInt(tree.TopFile.ctl), Node.of(serialOf(p), .ctl), Node.ofCol(col, .ctl) }) |node| {
const r = wr(p, node, "Wrap off\nbo\x01gus\n");
try testing.expectEqual(E.INVAL, r.errno());
try testing.expectEqualStrings(e_control, r.reply.ename);
@@ -1325,7 +1325,7 @@ test "pane ctl read is acme's fields -- index's five, width in cells, font, tab
test "commands lists every builtin with its argument and the ctl that takes it" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const node = @intFromEnum(tree.TopFile.commands);
+ const node = @backingInt(tree.TopFile.commands);
const listed = rd(p, node, 0, 1 << 16);
try testing.expectEqual(@as(u64, listed.bytes.len), call(p, .{ .tag = 1, .op = .getattr, .node = node }).reply.attr.size);
try testing.expectEqual(E.PERM, wr(p, node, "Del\n").errno());
@@ -1372,7 +1372,7 @@ test "focus reads the pane with the keyboard, and a serial written to it moves t
defer p.deinit();
const first = serialOf(p);
const second = try th.newPane(p);
- const focus = @intFromEnum(tree.TopFile.focus);
+ const focus = @backingInt(tree.TopFile.focus);
var line: [16]u8 = undefined;
try testing.expectEqualStrings(try std.fmt.bufPrint(&line, "{d}\n", .{second}), rd(p, focus, 0, 64).bytes);
try testing.expectEqual(@as(u64, rd(p, focus, 0, 64).bytes.len), call(p, .{ .tag = 1, .op = .getattr, .node = focus }).reply.attr.size);
@@ -1447,7 +1447,7 @@ test "the root ctl reads the settings as a write takes them, and takes the sessi
const gpa = testing.allocator;
const p = try withFile(gpa, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
const first = rd(p, root_ctl, 0, 1 << 16);
try testing.expectEqual(Status.ok, first.reply.status);
const settings = try gpa.dupe(u8, first.bytes);
@@ -1575,7 +1575,7 @@ test "a write of an Edit block carries it whole, to a pane's ctl, the root's ctl
try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .ctl), "Edit ,x/foo/{\ni/[/\na/]/\n}\n").reply.status);
try testing.expectEqualStrings("[foo] x\n[foo] y\n", rd(p, body, 0, 64).bytes);
p.active = p.paneBySerial(serial).?;
- try testing.expectEqual(Status.ok, wr(p, @intFromEnum(tree.TopFile.ctl), "Edit ,x/\\[/{\nc/</\n}\n").reply.status);
+ try testing.expectEqual(Status.ok, wr(p, @backingInt(tree.TopFile.ctl), "Edit ,x/\\[/{\nc/</\n}\n").reply.status);
try testing.expectEqualStrings("<foo] x\n<foo] y\n", rd(p, body, 0, 64).bytes);
try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .exec), "Edit $a\nend\n.\n").reply.status);
try testing.expectEqualStrings("<foo] x\n<foo] y\nend\n", rd(p, body, 0, 64).bytes);
@@ -1603,11 +1603,11 @@ test "a message from a root ctl write is the session's in the log" {
defer p.deinit();
p.update(.tick); // the pane's `new` is logged before the log is opened
while (p.nextEffect()) |_| {}
- const log = @intFromEnum(tree.TopFile.log);
+ const log = @backingInt(tree.TopFile.log);
const f = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle;
const frozen = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = f, .size = 8192 }).bytes.len;
_ = call(p, .{ .tag = 3, .op = .write, .node = log, .handle = f, .data = "follow" });
- try testing.expectEqual(Status.ok, wr(p, @intFromEnum(tree.TopFile.ctl), "Kill\n").reply.status);
+ try testing.expectEqual(Status.ok, wr(p, @backingInt(tree.TopFile.ctl), "Kill\n").reply.status);
// What it said, the session's; its own words name it, so its Verbose
// announcement gives way to them.
try testing.expectEqualStrings("msg - Kill: nothing running\n", call(p, .{ .tag = 5, .op = .read, .node = log, .handle = f, .off = frozen, .size = 4096 }).bytes);
@@ -1661,7 +1661,7 @@ test "the root look's file:/re/ goes on from the dot, and a miss leaves the dot
const p = try withFile(gpa, "foo x foo y\nfoo\n");
defer p.deinit();
const dot = Node.of(serialOf(p), .dot);
- const root = @intFromEnum(tree.TopFile.look);
+ const root = @backingInt(tree.TopFile.look);
var line: [256]u8 = undefined;
const path = p.panes[0].?.file.?.path;
const again = try std.fmt.bufPrint(&line, "{s}:/foo/\n", .{path});
@@ -1677,7 +1677,7 @@ test "a look's miss repeats the path whole up to 256 bytes, then gives up its mi
const gpa = testing.allocator;
const p = try withFile(gpa, "x\n");
defer p.deinit();
- const root = @intFromEnum(tree.TopFile.look);
+ const root = @backingInt(tree.TopFile.look);
const long = "some/deeply/nested/directory/that/goes/on/and/on/with/a_rather_long_file_name.txt";
var line: [512]u8 = undefined;
_ = wr(p, root, try std.fmt.bufPrint(&line, "{s}\n", .{long}));
@@ -1926,7 +1926,7 @@ test "Zerox makes a second pane on one buffer: one text, undo and dirty state, i
const a = p.panes[0].?;
const b = p.panes[twin_id].?;
// Both in the index, each its serial, one name.
- const index = rd(p, @intFromEnum(tree.TopFile.index), 0, 4096).bytes;
+ const index = rd(p, @backingInt(tree.TopFile.index), 0, 4096).bytes;
try testing.expectEqual(@as(usize, 2), std.mem.count(u8, index, "/z.txt"));
// b's cursor on `three`; a line written above it in a moves it down.
b.body.cur_row = 2;
@@ -2070,7 +2070,7 @@ test "a bad Tab width and a bad Incl directory are refused invalid, changing not
defer config.tab_now = config.tab_width;
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
for ([_][]const u8{ "Tab 0\n", "Tab 17\n", "Tab x\n" }) |line| {
try testing.expectEqual(E.INVAL, wr(p, root_ctl, line).errno());
// Run from a pane, as a tag click runs it: said invalid too.
@@ -2153,7 +2153,7 @@ test "round 39's small refusals: one name an open, small scratches unasked, twin
tree.runClosedLines(p);
try testing.expectEqualStrings("/tmp/pardes-one.txt", pane.file.?.path);
// Bare Tab on the root ctl says the width, as from a pane.
- try testing.expectEqual(Status.ok, wr(p, @intFromEnum(tree.TopFile.ctl), "Tab\n").reply.status);
+ try testing.expectEqual(Status.ok, wr(p, @backingInt(tree.TopFile.ctl), "Tab\n").reply.status);
// Errnos a mount reads from the words.
_ = wr(p, Node.of(serial, .name), try std.fmt.bufPrint(&line, "{s}/f.txt\n", .{dir}));
try testing.expect(p.executeBuiltinLine(0, "Get"));
@@ -2230,7 +2230,7 @@ test "Mount with no dial is wrong #args, and a dial that is no address says bad
if (comptime !pardes.hosted) return;
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
const bare = wr(p, root_ctl, "Mount work\n");
try testing.expectEqual(E.INVAL, bare.errno());
try testing.expectStringStartsWith(bare.reply.ename, "wrong #args");
@@ -2326,7 +2326,7 @@ test "a refusal's +Unsaved goes in the session's directory when the active pane'
const serial = serialOf(p);
try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/pardes-no-such-dir-zz/x.txt\n").reply.status);
try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .body), "edited\n").reply.status);
- try testing.expectEqual(Status.err, wr(p, @intFromEnum(tree.TopFile.ctl), "Exit\n").reply.status);
+ try testing.expectEqual(Status.err, wr(p, @backingInt(tree.TopFile.ctl), "Exit\n").reply.status);
const unsaved = for (p.panes) |slot| {
const pane = slot orelse continue;
const f = pane.file orelse continue;
@@ -2357,7 +2357,7 @@ test "a look at a file it may not read fails the write naming the file" {
test "Pager is a setting of the root ctl: pardes by default, off taken, anything else refused with its choices" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
try testing.expect(std.mem.indexOf(u8, rd(p, root_ctl, 0, 1 << 16).bytes, "Pager pardes\n") != null);
try testing.expectEqual(Status.ok, wr(p, root_ctl, "Pager off\n").reply.status);
try testing.expectEqual(config.Runtime.Pager.off, p.settings.pager);
@@ -2368,7 +2368,7 @@ test "Pager is a setting of the root ctl: pardes by default, off taken, anything
test "a bad setting value is quoted, so two different bad values log as two records, never one counted twice" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
_ = wr(p, root_ctl, "Verbose maybe\n");
_ = wr(p, root_ctl, "Verbose nope\n");
try testing.expect(th.logHas(p, "takes on, off \"maybe\"\n"));
@@ -2494,14 +2494,14 @@ test "look and exec read back what the last command touched, a ctl write's too"
const made = p.panes[p.active].?.serial;
try testing.expect(made != serial);
try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{made}), rd(p, root_exec, 0, 64).bytes);
- try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{made}), rd(p, @intFromEnum(tree.TopFile.look), 0, 64).bytes);
+ try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{made}), rd(p, @backingInt(tree.TopFile.look), 0, 64).bytes);
// A ctl write that makes nothing names the pane it ran at.
- try testing.expectEqual(tree.Status.ok, wr(p, @intFromEnum(tree.TopFile.ctl), "Verbose off\n").reply.status);
+ try testing.expectEqual(tree.Status.ok, wr(p, @backingInt(tree.TopFile.ctl), "Verbose off\n").reply.status);
try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{made}), rd(p, root_exec, 0, 64).bytes);
// Closed, it is no pane to go to: a fresh read of look is empty.
try testing.expectEqual(tree.Status.ok, wr(p, Node.of(made, .ctl), "Del\n").reply.status);
try testing.expect(p.paneBySerial(made) == null);
- try testing.expectEqualStrings("", rd(p, @intFromEnum(tree.TopFile.look), 0, 64).bytes);
+ try testing.expectEqualStrings("", rd(p, @backingInt(tree.TopFile.look), 0, 64).bytes);
}
test "a builtin's Verbose announcement is logged only when it succeeds, its failure said now or by the host later" {
@@ -2568,7 +2568,7 @@ test "an error's words give the errno a mount reads: EINVAL for what is malforme
test "DumpConfig's whole report writes back to the root ctl, line by line, with no error" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
try testing.expectEqual(Status.ok, wr(p, root_ctl, "DumpConfig\n").reply.status);
const report = for (p.panes) |slot| {
const pane = slot orelse continue;
@@ -2594,7 +2594,7 @@ test "a Restore asks again for the ThemeFile the dump names, as a /ctl write of
const p = try withFile(gpa, "x\n");
defer p.deinit();
const good = "/tmp/pardes-restored-theme.zon";
- _ = wr(p, @intFromEnum(tree.TopFile.ctl), "ThemeFile " ++ good ++ "\n");
+ _ = wr(p, @backingInt(tree.TopFile.ctl), "ThemeFile " ++ good ++ "\n");
var custom = pardes.themes[0];
custom.name = "restored";
var encoded: std.Io.Writer.Allocating = .init(gpa);
@@ -2622,7 +2622,7 @@ test "a ThemeFile that fails to load changes nothing: the root ctl still names t
const gpa = testing.allocator;
const p = try withFile(gpa, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
// None loaded: a failed one leaves Theme as it was.
_ = wr(p, root_ctl, "ThemeFile /tmp/pardes-no-such-theme.zon\n");
pardes.colors.failThemeFile(p, p.theme_file_generation, error.FileNotFound);
@@ -2648,7 +2648,7 @@ test "after a ThemeFile the root ctl and DumpConfig say ThemeFile and its path,
const gpa = testing.allocator;
const p = try withFile(gpa, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
const path = "/tmp/pardes-mine-theme.zon";
try testing.expectEqual(Status.ok, wr(p, root_ctl, "ThemeFile " ++ path ++ "\n").reply.status);
var custom = pardes.themes[0];
@@ -2682,7 +2682,7 @@ test "Joincol with no column to the right and Theme with no such theme say so" {
const gpa = testing.allocator;
const p = try withFile(gpa, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
const joined = wr(p, root_ctl, "Joincol\n");
try testing.expectEqual(tree.Status.err, joined.reply.status);
try testing.expectStringStartsWith(joined.reply.ename, "Joincol: no column to the right");
@@ -2731,10 +2731,10 @@ test "a look after Newcol fills the empty column the keyboard is on" {
var line: [4200]u8 = undefined;
// Newcol makes an empty column and gives its tag the keyboard; no pane
// has it, so focus reads empty.
- try testing.expectEqual(tree.Status.ok, wr(p, @intFromEnum(tree.TopFile.ctl), "Newcol\n").reply.status);
+ try testing.expectEqual(tree.Status.ok, wr(p, @backingInt(tree.TopFile.ctl), "Newcol\n").reply.status);
try testing.expectEqual(@as(usize, 0), p.col_n[p.ncol - 1]);
- try testing.expectEqualStrings("", rd(p, @intFromEnum(tree.TopFile.focus), 0, 64).bytes);
- try testing.expectEqual(tree.Status.ok, wr(p, @intFromEnum(tree.TopFile.look), try std.fmt.bufPrint(&line, "{s}/f.txt\n", .{at})).reply.status);
+ try testing.expectEqualStrings("", rd(p, @backingInt(tree.TopFile.focus), 0, 64).bytes);
+ try testing.expectEqual(tree.Status.ok, wr(p, @backingInt(tree.TopFile.look), try std.fmt.bufPrint(&line, "{s}/f.txt\n", .{at})).reply.status);
try testing.expectEqual(@as(usize, 1), p.col_n[p.ncol - 1]);
try testing.expectEqual(p.active, p.col_panes[p.ncol - 1][0]);
}
@@ -2807,7 +2807,7 @@ test "a Restore of a file that is no dump fails the write before any warning, an
const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)];
var line_buf: [4200]u8 = undefined;
const line = try std.fmt.bufPrint(&line_buf, "Restore {s}/notes.txt\n", .{dir});
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
const refused = wr(p, root_ctl, line);
try testing.expectEqual(E.IO, refused.errno());
try testing.expect(std.mem.indexOf(u8, refused.reply.ename, "not a pardes dump: line 1: ") != null);
@@ -2827,7 +2827,7 @@ test "a Restore of a file that is no dump fails the write before any warning, an
test "a setting this frontend cannot show says GUI-only, and DumpDir reads back the directory in effect" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
if (!builtins.capabilities.lift) {
try testing.expectEqualStrings("Lift is GUI-only, invalid here \"Lift\"", wr(p, root_ctl, "Lift on\n").reply.ename);
try testing.expectEqualStrings("GripWidth is GUI-only, invalid here \"GripWidth\"", wr(p, root_ctl, "GripWidth 120\n").reply.ename);
@@ -2852,7 +2852,7 @@ test "a setting this frontend cannot show says GUI-only, and DumpDir reads back
test "Shell refuses a path that is no executable, and bare it goes back to the default" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
const refused = wr(p, root_ctl, "Shell /nonexistent/zzsh\n");
try testing.expectEqual(Status.err, refused.reply.status);
try testing.expect(std.mem.indexOf(u8, refused.reply.ename, "Shell: shell \"/nonexistent/zzsh\" not found") != null);
@@ -2875,9 +2875,9 @@ test "a builtin that fails a ctl write logs only its err, so the same failure ag
defer p.deinit();
p.update(.tick); // the pane's `new` is logged first
while (p.nextEffect()) |_| {}
- const ctl_node = @intFromEnum(tree.TopFile.ctl);
+ const ctl_node = @backingInt(tree.TopFile.ctl);
for (0..3) |_| try testing.expectEqual(Status.err, wr(p, ctl_node, "Unmount zzz\n").reply.status);
- const log = @intFromEnum(tree.TopFile.log);
+ const log = @backingInt(tree.TopFile.log);
const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle;
const text = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes;
try testing.expect(std.mem.endsWith(u8, text, "err - ctl: Unmount: no such mount zzz (x3)\n"));
@@ -2915,7 +2915,7 @@ test "Edit's p and = never fail for want of room for +Errors: the text is logged
test "size sets the screen of a session no frontend is attached to, and only of one" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
try testing.expectEqual(E.INVAL, wr(p, root_ctl, "size 120 40\n").errno()); // a frontend's
p.unattended = true;
try testing.expectEqual(Status.ok, wr(p, root_ctl, "size 120 40\n").reply.status);
@@ -2937,7 +2937,7 @@ test "size sets the screen of a session no frontend is attached to, and only of
test "Mount dials its peer and fails, mounting nothing, when none answers; a look through a peer gone says dial failed" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
const dead = "/tmp/pardes-test-no-such-peer.sock";
// A socket path not there is said so; one there that does not answer
// (a directory here) is a dial that failed.
@@ -2955,7 +2955,7 @@ test "Mount dials its peer and fails, mounting nothing, when none answers; a loo
try testing.expectEqualStrings("get: /n/away/f.txt: dial failed: no answer", got.reply.ename);
// Mounted when it answered, gone since: a look through it says so.
try p.fs.mounts.append(p.gpa, .{ .name = try p.gpa.dupe(u8, "gone"), .dial = try p.gpa.dupe(u8, dead) });
- const looked = wr(p, @intFromEnum(tree.TopFile.look), "/n/gone/f.txt\n");
+ const looked = wr(p, @backingInt(tree.TopFile.look), "/n/gone/f.txt\n");
try testing.expect(looked.errno() != 0);
try testing.expect(th.logHas(p, "look: /n/gone/f.txt: dial failed: no answer"));
}
@@ -3005,7 +3005,7 @@ test "Tty in a directory that is not there fails and makes no pane; a shell that
test "a builtin that needs its argument, written bare to an exec, is EINVAL as through ctl" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- for ([_]u64{ root_exec, Node.of(serialOf(p), .exec), @intFromEnum(tree.TopFile.tagexec) }) |node| {
+ for ([_]u64{ root_exec, Node.of(serialOf(p), .exec), @backingInt(tree.TopFile.tagexec) }) |node| {
const refused = wr(p, node, "Mount\n");
try testing.expectEqual(E.INVAL, refused.errno());
try testing.expectEqualStrings("wrong #args in control message \"Mount\"", refused.reply.ename);
@@ -3069,7 +3069,7 @@ test "Grep with no hit says grep: no match and opens nothing, a missing pane dir
test "Unmount of a name not mounted says no such mount, which a mount reads as ENOENT" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const refused = wr(p, @intFromEnum(tree.TopFile.ctl), "Unmount nothere\n");
+ const refused = wr(p, @backingInt(tree.TopFile.ctl), "Unmount nothere\n");
try testing.expectEqual(E.NOENT, refused.errno());
try testing.expectStringStartsWith(refused.reply.ename, "Unmount: no such mount nothere");
}
@@ -3106,7 +3106,7 @@ test "a terminal with text typed at its prompt is never typed into: a look at it
while (p.nextEffect()) |_| {}
var count: usize = 0;
for (p.panes) |slot| count += @intFromBool(slot != null);
- try testing.expectEqual(Status.ok, wr(p, @intFromEnum(tree.TopFile.look), "/tmp\n").reply.status);
+ try testing.expectEqual(Status.ok, wr(p, @backingInt(tree.TopFile.look), "/tmp\n").reply.status);
var typed_into = false;
while (p.nextEffect()) |effect| if (effect == .write and effect.write.pane == term) {
typed_into = true;
@@ -3336,7 +3336,7 @@ test "+Unsaved drops a pane once it has closed" {
const b = try th.newPane(p);
_ = wr(p, Node.of(b, .name), "/tmp/pardes-unsaved-b.txt\n");
_ = wr(p, Node.of(b, .body), "edited\n");
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
try testing.expectEqual(Status.err, wr(p, root_ctl, "Exit\n").reply.status);
var listed: ?*pardes.Pane = null;
for (p.panes) |slot| if (slot) |q| if (q.file) |f| if (f.output) |o| if (o.from == .unsaved) {
@@ -3417,7 +3417,7 @@ test "with no pane at all, the root look opens its file and the root exec runs i
}
};
try Empty.all(p);
- const look_node = @intFromEnum(tree.TopFile.look);
+ const look_node = @backingInt(tree.TopFile.look);
try testing.expectEqual(Status.ok, wr(p, look_node, "f.txt\n").reply.status);
var want: [4200]u8 = undefined;
const path = try std.fmt.bufPrint(&want, "{s}/f.txt", .{session});
@@ -3432,7 +3432,7 @@ test "with no pane at all, the root look opens its file and the root exec runs i
try testing.expectEqual(@as(usize, 0), scratches);
try Empty.all(p);
- try testing.expectEqual(Status.ok, wr(p, @intFromEnum(tree.TopFile.exec), "echo hi\n").reply.status);
+ try testing.expectEqual(Status.ok, wr(p, @backingInt(tree.TopFile.exec), "echo hi\n").reply.status);
const made = p.panes[p.anyPane().?].?;
try testing.expect(made.command != null);
try testing.expectEqualStrings(session, made.cwdSlice());
@@ -3453,7 +3453,7 @@ test "a look at file:3:0 is refused as addr 3:0 is, a column counting from 1" {
test "Kill with a name and nothing running says so and does not fail, as bare Kill does" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const r = wr(p, @intFromEnum(tree.TopFile.ctl), "Kill zzz\n");
+ const r = wr(p, @backingInt(tree.TopFile.ctl), "Kill zzz\n");
try testing.expectEqual(Status.ok, r.reply.status);
try testing.expect(th.logHas(p, "Kill: nothing running"));
}
@@ -3519,7 +3519,7 @@ test "a focus moved over 9P tells the programs that asked for focus reports, as
p.update(.{ .output = .{ .pane = @intCast(shells[1]), .bytes = "\x1b[?1004h" } });
while (p.nextEffect()) |_| {}
var digits: [16]u8 = undefined;
- const moved = wr(p, @intFromEnum(tree.TopFile.focus), try std.fmt.bufPrint(&digits, "{d}\n", .{p.panes[shells[1]].?.serial}));
+ const moved = wr(p, @backingInt(tree.TopFile.focus), try std.fmt.bufPrint(&digits, "{d}\n", .{p.panes[shells[1]].?.serial}));
try testing.expectEqual(Status.ok, moved.reply.status);
try testing.expectEqual(shells[1], p.active);
try testing.expectEqualStrings("\x1b[O\x1b[I", moved.pty_buf[0..moved.pty_len]);
@@ -3536,7 +3536,7 @@ test "a Restore of a name in the DumpDir asks for, and logs, the whole path it r
var buf: [4096]u8 = undefined;
const dir = buf[0..try tmp.dir.realPath(testing.io, &buf)];
try testing.expect(p.settings.dump_dir.set(dir));
- try testing.expectEqual(Status.ok, wr(p, @intFromEnum(tree.TopFile.ctl), "Restore x.dump.zon\n").reply.status);
+ try testing.expectEqual(Status.ok, wr(p, @backingInt(tree.TopFile.ctl), "Restore x.dump.zon\n").reply.status);
var want: [4200]u8 = undefined;
try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{s}/x.dump.zon", .{dir}), p.restore_req.?);
}
@@ -3546,11 +3546,11 @@ test "a line starting with # runs as nothing at an exec or a ctl, silently" {
defer p.deinit();
const serial = serialOf(p);
// The setup's own announcements are made by the first write's update.
- _ = wr(p, @intFromEnum(tree.TopFile.ctl), "# settle\n");
+ _ = wr(p, @backingInt(tree.TopFile.ctl), "# settle\n");
const before = p.next_serial;
const log_before = try pardes.ctlfs.events.freezeLog(p);
defer p.gpa.free(log_before.bytes);
- for ([_]u64{ @intFromEnum(tree.TopFile.exec), Node.of(serial, .exec), @intFromEnum(tree.TopFile.ctl), Node.of(serial, .ctl), Node.ofCol(layout.columnSerial(p, 0), .ctl) }) |node| {
+ for ([_]u64{ @backingInt(tree.TopFile.exec), Node.of(serial, .exec), @backingInt(tree.TopFile.ctl), Node.of(serial, .ctl), Node.ofCol(layout.columnSerial(p, 0), .ctl) }) |node| {
try testing.expectEqual(Status.ok, wr(p, node, "# Platform: tty\n # indented too\n").reply.status);
}
try testing.expectEqual(before, p.next_serial);
@@ -3574,7 +3574,7 @@ test "a builtin that takes no argument, written with one to an exec, is refused
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
const serial = serialOf(p);
- for ([_]u64{ @intFromEnum(tree.TopFile.exec), Node.of(serial, .exec) }) |node| for ([_][]const u8{ "Config extra\n", "DumpConfig extra\n" }) |line| {
+ for ([_]u64{ @backingInt(tree.TopFile.exec), Node.of(serial, .exec) }) |node| for ([_][]const u8{ "Config extra\n", "DumpConfig extra\n" }) |line| {
const r = wr(p, node, line);
try testing.expectEqual(E.INVAL, r.errno());
try testing.expectStringStartsWith(r.reply.ename, "wrong #args in control message");
@@ -3680,7 +3680,7 @@ test "every EINVAL a write gets says why, in its err record too; DEL is a contro
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
const serial = serialOf(p);
- const log = @intFromEnum(tree.TopFile.log);
+ const log = @backingInt(tree.TopFile.log);
const h = call(p, .{ .tag = 1, .op = .open, .node = log, .omode = 2 }).reply.handle;
const Case = struct { node: u64, data: []const u8, words: []const u8, handle: u32 = 0 };
for ([_]Case{
@@ -3703,19 +3703,19 @@ test "/index shows a name as the log does: a newline in it is \\n, a control byt
defer p.deinit();
const term = p.paneBySerial(serialOf(p)).?;
p.setCwd(term, "/tmp/two\nlines\x07\x7f\xc2\x85\xff");
- const index = rd(p, @intFromEnum(tree.TopFile.index), 0, 4096).bytes;
+ const index = rd(p, @backingInt(tree.TopFile.index), 0, 4096).bytes;
// Each byte as itself, so the name decodes to what it is.
try testing.expect(std.mem.indexOf(u8, index, "/tmp/two\\nlines\\x07\\x7f\\xc2\\x85\\xff ") != null);
try testing.expectEqual(@as(usize, 1), std.mem.count(u8, index, "\n"));
try testing.expect(index.len > 0);
- try testing.expectEqual(@as(u64, 0), call(p, .{ .tag = 1, .op = .getattr, .node = @intFromEnum(tree.TopFile.index) }).reply.attr.size);
+ try testing.expectEqual(@as(u64, 0), call(p, .{ .tag = 1, .op = .getattr, .node = @backingInt(tree.TopFile.index) }).reply.attr.size);
// Its tag never carries the raw newline either.
const tag = rd(p, Node.of(serialOf(p), .tag), 0, 4096).bytes;
try testing.expect(std.mem.indexOf(u8, tag, "/tmp/two\\nlines") != null);
// A backslash of the name's own is doubled: `\n` written in a name
// reads back unlike a newline.
p.setCwd(term, "/tmp/back\\nslash");
- try testing.expect(std.mem.indexOf(u8, rd(p, @intFromEnum(tree.TopFile.index), 0, 4096).bytes, "/tmp/back\\\\nslash") != null);
+ try testing.expect(std.mem.indexOf(u8, rd(p, @backingInt(tree.TopFile.index), 0, 4096).bytes, "/tmp/back\\\\nslash") != null);
}
test "a look at a ./ or ../ name that is not there is a miss naming the file; a plain one is looked for as text" {
@@ -3766,7 +3766,7 @@ test "a served-tree pane spoils no Grep, and Look . from a gone directory is ENO
test "a tag write refuses NUL and the other control characters" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- for ([_]u64{ @intFromEnum(tree.TopFile.tag), tree.Node.ofCol(pardes.layout.columnSerial(p, 0), .tag), Node.of(serialOf(p), .tag) }) |node| {
+ for ([_]u64{ @backingInt(tree.TopFile.tag), tree.Node.ofCol(pardes.layout.columnSerial(p, 0), .tag), Node.of(serialOf(p), .tag) }) |node| {
const refused = wr(p, node, " a\x00b");
try testing.expectEqual(E.INVAL, refused.errno());
try testing.expectStringStartsWith(refused.reply.ename, "invalid tag text");
@@ -3815,7 +3815,7 @@ test "a column takes panes until their documented minimums fill it, not until no
const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 50 });
defer p.deinit();
while (p.nextEffect()) |_| {}
- const new = @intFromEnum(tree.TopFile.new);
+ const new = @backingInt(tree.TopFile.new);
while (call(p, .{ .tag = 1, .op = .open, .node = new }).reply.status == .ok) p.sync();
p.sync();
const avail = p.screen_h - (p.topBarHeight() + p.columnBarHeight());
@@ -3913,13 +3913,13 @@ test "a closed file is found again: Recent and /recent list it closed, a look at
const opened = p.active;
try testing.expectEqualStrings(a, p.panes[opened].?.file.?.path);
var want: [4300]u8 = undefined;
- try testing.expect(std.mem.indexOf(u8, rd(p, @intFromEnum(tree.TopFile.recent), 0, 8192).bytes, try std.fmt.bufPrint(&want, "open {s}\n", .{a})) != null);
+ try testing.expect(std.mem.indexOf(u8, rd(p, @backingInt(tree.TopFile.recent), 0, 8192).bytes, try std.fmt.bufPrint(&want, "open {s}\n", .{a})) != null);
// Another file, so the jumplist has somewhere to come back from.
try testing.expectEqual(Status.ok, wr(p, root_look, try std.fmt.bufPrint(&line, "{s}/b.txt\n", .{dir})).reply.status);
p.sync();
try testing.expectEqual(Status.ok, wr(p, Node.of(p.panes[opened].?.serial, .ctl), "Del\n").reply.status);
p.sync();
- try testing.expect(std.mem.indexOf(u8, rd(p, @intFromEnum(tree.TopFile.recent), 0, 8192).bytes, try std.fmt.bufPrint(&want, "closed {s}\n", .{a})) != null);
+ try testing.expect(std.mem.indexOf(u8, rd(p, @backingInt(tree.TopFile.recent), 0, 8192).bytes, try std.fmt.bufPrint(&want, "closed {s}\n", .{a})) != null);
// Recent lists it, closed, at its dot; a look at the row opens it there.
try testing.expectEqual(Status.ok, wr(p, root_exec, "Recent\n").reply.status);
const rows = p.panes[p.paneBySerial(try std.fmt.parseInt(u32, std.mem.trimEnd(u8, rd(p, root_exec, 0, 64).bytes, "\n"), 10)).?].?;
@@ -4045,8 +4045,8 @@ test "Back and Forward written to exec keep to the focused file, and JumpScope a
.{ .word = "Forward", .file = "/b.txt", .line = 80 },
.{ .word = "Forward", .file = "/a.txt", .line = 80 },
});
- try testing.expectEqual(Status.ok, wr(p, @intFromEnum(tree.TopFile.ctl), "JumpScope all\n").reply.status);
- try testing.expect(std.mem.indexOf(u8, rd(p, @intFromEnum(tree.TopFile.ctl), 0, 8192).bytes, "JumpScope all\n") != null);
+ try testing.expectEqual(Status.ok, wr(p, @backingInt(tree.TopFile.ctl), "JumpScope all\n").reply.status);
+ try testing.expect(std.mem.indexOf(u8, rd(p, @backingInt(tree.TopFile.ctl), 0, 8192).bytes, "JumpScope all\n") != null);
try walk(p, &.{
.{ .word = "Back", .file = "/b.txt", .line = 80 },
.{ .word = "Back", .file = "/a.txt", .line = 40 },
@@ -4102,14 +4102,14 @@ test "a new file saved shows in /recent, open, while it is" {
try testing.expectEqual(Status.ok, wr(p, Node.of(made, .ctl), "Save\n").reply.status);
p.perform(.{ .save_file = .{ .pane = @intCast(p.paneBySerial(made).?) } });
var want: [4300]u8 = undefined;
- try testing.expect(std.mem.indexOf(u8, rd(p, @intFromEnum(tree.TopFile.recent), 0, 8192).bytes, try std.fmt.bufPrint(&want, "open {s}\n", .{path})) != null);
+ try testing.expect(std.mem.indexOf(u8, rd(p, @backingInt(tree.TopFile.recent), 0, 8192).bytes, try std.fmt.bufPrint(&want, "open {s}\n", .{path})) != null);
}
test "/recent shows a name as /index does, a newline in it escaped" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
p.recent.opened(p.recentGpa(), "/tmp/a\nb\\c");
- const text = rd(p, @intFromEnum(tree.TopFile.recent), 0, 8192).bytes;
+ const text = rd(p, @backingInt(tree.TopFile.recent), 0, 8192).bytes;
try testing.expect(std.mem.indexOf(u8, text, "closed /tmp/a\\nb\\\\c\n") != null);
}
@@ -4191,8 +4191,8 @@ test "size is monotonic: growing is never refused, and a size once taken is take
defer p.deinit();
while (p.nextEffect()) |_| {}
p.unattended = true;
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
- const new = @intFromEnum(tree.TopFile.new);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
+ const new = @backingInt(tree.TopFile.new);
// The dogfood's repro: Newcol, three pane/new, a Tty, then pane/new
// until a column has no room (ENOSPC).
try testing.expectEqual(Status.ok, wr(p, root_ctl, "Newcol\n").reply.status);
@@ -4283,7 +4283,7 @@ test "a file changed on disk under unsaved edits is not reloaded: it says so, ge
var want: [32]u8 = undefined;
try testing.expect(th.logHas(p, try std.fmt.bufPrint(&want, "changed {d}\n", .{serial})));
// Exit and get still ask about the edits.
- try testing.expectEqual(Status.err, wr(p, @intFromEnum(tree.TopFile.ctl), "Exit\n").reply.status);
+ try testing.expectEqual(Status.err, wr(p, @backingInt(tree.TopFile.ctl), "Exit\n").reply.status);
try testing.expect(std.mem.indexOf(u8, wr(p, Node.of(serial, .ctl), "get\n").reply.ename, "Modified") != null);
// Save warns once before overwriting the newer file, then writes.
const first = wr(p, Node.of(serial, .ctl), "Save\n");
@@ -4328,7 +4328,7 @@ test "a looked word is found in its own pane, next place after the dot, wrapping
test "every word's /commands description is its own doc comment's first sentence, no citation" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const listed = rd(p, @intFromEnum(tree.TopFile.commands), 0, 1 << 16).bytes;
+ const listed = rd(p, @backingInt(tree.TopFile.commands), 0, 1 << 16).bytes;
for ([_][]const u8{
"\nRepl arg pane -- Binds this terminal as a language's REPL, so an exec on that language's files is typed into it instead of run.\n",
"\nJoincol root -- Fold the active pane's column into the one on its right, keeping its panes.\n",
@@ -4374,7 +4374,7 @@ test "Newcol at the column cap fails the write and says the cap" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
p.update(.{ .resize = .{ .cols = 4000, .rows = 30 } });
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
while (p.ncol < pardes.MAX_COLS) {
// From the widest column's tag, so no column gets too narrow first.
p.sync();
@@ -4403,7 +4403,7 @@ test "Save on a terminal asked over 9P is an ask in the log, answered with a pat
try testing.expect(p.panes[id].?.prompt == .save);
// Again: the one open stands, one ask in the log.
_ = wr(p, Node.of(serial, .tagexec), "Save\n");
- const log = @intFromEnum(tree.TopFile.log);
+ const log = @backingInt(tree.TopFile.log);
const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle;
try testing.expectEqual(@as(usize, 1), std.mem.count(u8, call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes, "save path\n"));
_ = call(p, .{ .tag = 3, .op = .release, .node = log, .handle = h });
@@ -4429,7 +4429,7 @@ test "get names the path it could not read, logs the edits it threw away, and a
pardes.panes.File.deleted(p, 0);
pardes.panes.File.deleted(p, 0);
var rec: [32]u8 = undefined;
- const log = @intFromEnum(tree.TopFile.log);
+ const log = @backingInt(tree.TopFile.log);
const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle;
try testing.expectEqual(@as(usize, 1), std.mem.count(u8, call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes, try std.fmt.bufPrint(&rec, "changed {d} deleted\n", .{serial})));
_ = call(p, .{ .tag = 3, .op = .release, .node = log, .handle = h });
@@ -4441,12 +4441,12 @@ test "a builtin that fails through exec, tagexec or a column's exec fails the wr
p.update(.tick); // the pane's `new` is logged first
while (p.nextEffect()) |_| {}
const serial = serialOf(p);
- for ([_]u64{ root_exec, Node.of(serial, .exec), @intFromEnum(tree.TopFile.tagexec), Node.ofCol(pardes.layout.columnSerial(p, 0), .exec) }) |node| {
+ for ([_]u64{ root_exec, Node.of(serial, .exec), @backingInt(tree.TopFile.tagexec), Node.ofCol(pardes.layout.columnSerial(p, 0), .exec) }) |node| {
const failed = wr(p, node, "Unmount zzz\n");
try testing.expectEqual(Status.err, failed.reply.status);
try testing.expect(std.mem.indexOf(u8, failed.reply.ename, "Unmount: no such mount zzz") != null);
}
- const log = @intFromEnum(tree.TopFile.log);
+ const log = @backingInt(tree.TopFile.log);
const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle;
const text = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes;
try testing.expect(std.mem.indexOf(u8, text, "msg ") == null);
@@ -4458,11 +4458,11 @@ test "a builtin that fails through exec, tagexec or a column's exec fails the wr
// A control character is refused with its reason.
try testing.expectEqualStrings(e_control, wr(p, root_exec, "Msg a\x01b\n").reply.ename);
// A look miss: one err, no msg.
- _ = wr(p, @intFromEnum(tree.TopFile.look), "zzqqnotthere\n");
+ _ = wr(p, @backingInt(tree.TopFile.look), "zzqqnotthere\n");
try testing.expect(th.logHas(p, "look: no match for \"zzqqnotthere\""));
try testing.expect(!th.logHas(p, "msg 1 Look: no match"));
// The same miss again is that record counted, as any repeated err is.
- _ = wr(p, @intFromEnum(tree.TopFile.look), "zzqqnotthere\n");
+ _ = wr(p, @backingInt(tree.TopFile.look), "zzqqnotthere\n");
try testing.expect(th.logHas(p, "look: no match for \"zzqqnotthere\" (x2)\n"));
}
@@ -4483,7 +4483,7 @@ test "@p<serial>:<address> takes any sam address; a miss and an unknown serial a
const p = try withFile(testing.allocator, "foo x foo y\nbar\n");
defer p.deinit();
const serial = serialOf(p);
- const root = @intFromEnum(tree.TopFile.look);
+ const root = @backingInt(tree.TopFile.look);
const dot = Node.of(serial, .dot);
const Case = struct { addr: []const u8, want: []const u8 };
for ([_]Case{
@@ -4544,7 +4544,7 @@ test "@p<terminal>:<address> takes any address over the terminal's lines, select
const id = p.paneBySerial(serial).?;
p.update(.{ .output = .{ .pane = @intCast(id), .bytes = "one\r\ntwo MARK three\r\n" } });
const pane = p.panes[id].?;
- const root = @intFromEnum(tree.TopFile.look);
+ const root = @backingInt(tree.TopFile.look);
var line: [64]u8 = undefined;
try testing.expectEqual(Status.ok, wr(p, root, try std.fmt.bufPrint(&line, "@p{d}:0/MARK/\n", .{serial})).reply.status);
try testing.expectEqual(@as(i32, 1), pane.body.cur_row);
@@ -4576,7 +4576,7 @@ test "a bad command inside an Edit block written whole is named, not the } after
test "a refused Delcol changes nothing: no pane, no focus" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- _ = wr(p, @intFromEnum(tree.TopFile.ctl), "Newcol\n");
+ _ = wr(p, @backingInt(tree.TopFile.ctl), "Newcol\n");
const made = try th.newPane(p);
_ = wr(p, Node.of(made, .name), "/tmp/pardes-delcol-refused.txt\n");
_ = wr(p, Node.of(made, .body), "edit\n");
@@ -4599,8 +4599,8 @@ test "a refused Delcol changes nothing: no pane, no focus" {
test "pager answers its +Pager on the open that asked, whatever another client exec'd meanwhile" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const pager = @intFromEnum(tree.TopFile.pager);
- const exec = @intFromEnum(tree.TopFile.exec);
+ const pager = @backingInt(tree.TopFile.pager);
+ const exec = @backingInt(tree.TopFile.exec);
const asked = call(p, .{ .tag = 1, .op = .open, .node = pager, .omode = 2 }).reply.handle;
try testing.expectEqual(Status.ok, call(p, .{ .tag = 2, .op = .write, .node = pager, .handle = asked, .data = "/tmp\n" }).reply.status);
const paged = for (p.panes) |slot| {
@@ -4653,7 +4653,7 @@ test "pager answers its +Pager on the open that asked, whatever another client e
test "what a /pager open writes after its directory is the text: plain in the body, its colours the pane's, clean, in by the read" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const pager = @intFromEnum(tree.TopFile.pager);
+ const pager = @backingInt(tree.TopFile.pager);
const asked = call(p, .{ .tag = 1, .op = .open, .node = pager, .omode = 2 }).reply.handle;
// The directory and the text's start in one write, escapes and all, a
// second line no directory; the rest in writes after it.
@@ -4812,7 +4812,7 @@ test "a second LookWord list look in a directory refills its +Search rather than
const path = try std.fmt.bufPrint(&path_buf, "{s}/words.txt", .{dir});
const p = try Pardes.init(gpa, .{ .file = path, .tty_only = true, .cols = 80, .rows = 30 });
defer p.deinit();
- _ = wr(p, @intFromEnum(tree.TopFile.ctl), "LookWord list\n");
+ _ = wr(p, @backingInt(tree.TopFile.ctl), "LookWord list\n");
pardes.look.lookAt(p, 0, "alpha");
pardes.look.lookAt(p, 0, "beta");
var searches: usize = 0;
@@ -4986,7 +4986,7 @@ test "DumpDir refuses a relative directory and one that may not be written, up f
if (comptime !pardes.hosted) return;
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ const root_ctl = @backingInt(tree.TopFile.ctl);
try testing.expectEqual(E.INVAL, wr(p, root_ctl, "DumpDir dumps\n").errno());
try testing.expectEqual(E.INVAL, wr(p, root_ctl, "DumpDir /proc/1/root/dumps\n").errno());
try testing.expectEqual(Status.ok, wr(p, root_ctl, "DumpDir /tmp/pardes-dumps-test\n").reply.status);
@@ -4998,7 +4998,7 @@ test "DumpDir refuses a relative directory and one that may not be written, up f
test "a Mount dial with a network it does not know is a bad dial address, EINVAL" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const r = wr(p, @intFromEnum(tree.TopFile.ctl), "Mount peer nowhere!x\n");
+ const r = wr(p, @backingInt(tree.TopFile.ctl), "Mount peer nowhere!x\n");
try testing.expectEqual(E.INVAL, r.errno());
try testing.expectStringStartsWith(r.reply.ename, "Mount: bad dial address: nowhere!x");
}
@@ -5056,11 +5056,11 @@ test "a Mount of a socket path that is not there says no such socket, ENOENT" {
if (comptime !pardes.hosted) return;
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- const r = wr(p, @intFromEnum(tree.TopFile.ctl), "Mount peer unix!/tmp/pardes-surely-no-socket\n");
+ const r = wr(p, @backingInt(tree.TopFile.ctl), "Mount peer unix!/tmp/pardes-surely-no-socket\n");
try testing.expectEqual(E.NOENT, r.errno());
try testing.expect(std.mem.indexOf(u8, r.reply.ename, "no such socket") != null);
try testing.expectEqual(@as(usize, 0), p.fs.mounts.items.len);
- try testing.expectEqual(E.INVAL, wr(p, @intFromEnum(tree.TopFile.ctl), "Mount peer rel/x.sock\n").errno());
+ try testing.expectEqual(E.INVAL, wr(p, @backingInt(tree.TopFile.ctl), "Mount peer rel/x.sock\n").errno());
}
test "the init file reads past a BOM, and every line it fails is a notice and an err, never silent" {