From b6200709aa5e42f7a3d3702489301c71da8cd65d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 30 Sep 2026 19:57:44 -0300 Subject: DumpConfig writes a setting this shell cannot show as a "# Word unsupported" comment, GripWidth among them on the tty, so the whole report writes back to /ctl The report said it could be written back as is, but "Lift unsupported" and the tty's "GripWidth 100" were each refused by the root ctl, and "DumpDir (none)" would have named a directory "(none)". Those lines are now comments, and a test writes every line of the report back. Co-Authored-By: Claude Opus 5.5 --- src/ninep/ctl.zig | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/ninep/ctl.zig') diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 2cd865de..eff8003b 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1836,6 +1836,29 @@ 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); + try testing.expectEqual(Status.ok, wr(p, root_ctl, "DumpConfig\n").reply.status); + const report = for (p.panes) |slot| { + const pane = slot orelse continue; + const f = pane.file orelse continue; + const o = f.output orelse continue; + if (std.meta.eql(o.from, panes.Output.Origin{ .cmd = .DumpConfig })) break try testing.allocator.dupe(u8, f.content); + } else return error.NoDumpConfigPane; + defer testing.allocator.free(report); + // What this shell cannot show is a comment, never a value it refuses. + if (pardes.platform == .tty) try testing.expect(std.mem.indexOf(u8, report, "# GripWidth unsupported\n") != null); + var lines = std.mem.splitScalar(u8, report, '\n'); + while (lines.next()) |line| { + if (line.len == 0) continue; + const r = wr(p, root_ctl, line); + if (r.reply.status != .ok) std.debug.print("refused: {s}: {s}\n", .{ line, r.reply.ename }); + try testing.expectEqual(Status.ok, r.reply.status); + } +} + test "after a ThemeFile the root ctl and DumpConfig say ThemeFile and its path, which writes back" { if (comptime !pardes.hosted) return; const gpa = testing.allocator; -- cgit v1.3