diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 19:57:44 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | b6200709aa5e42f7a3d3702489301c71da8cd65d (patch) | |
| tree | 0042cad5c71f4cac613028fa20757c4dd1a5e3a7 /src/ninep | |
| parent | 63983ab4b235fb2b6617e8d055e644e0e986d8fd (diff) | |
| download | pardes-b6200709aa5e42f7a3d3702489301c71da8cd65d.tar.gz pardes-b6200709aa5e42f7a3d3702489301c71da8cd65d.zip | |
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 <[email protected]>
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/ctl.zig | 23 |
1 files changed, 23 insertions, 0 deletions
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; |
