diff options
Diffstat (limited to 'src/fs.zig')
| -rw-r--r-- | src/fs.zig | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -19,7 +19,14 @@ const Reply = tree.Reply; const E = tree.E; /// The served README; tree.zig answers it. -pub const help = @embedFile("fs-help.txt"); +/// The tree's README; a build that embeds no sources lists no src/. +pub const help = help: { + const raw = @embedFile("fs-help.txt"); + if (limits.embedded_sources) break :help raw; + const both = "os/, src/ the host filesystem; the editor's own sources"; + const at = std.mem.indexOf(u8, raw, both) orelse @compileError("fs-help.txt no longer lists os/, src/"); + break :help raw[0..at] ++ "os/ the host filesystem" ++ raw[at + both.len ..]; +}; /// Host filesystem nodes: the root, and one hashed node per path a client walked to. pub const os_root: u64 = (1 << 63) + 2; @@ -491,7 +498,7 @@ test "bounded reads release terminal snapshots after success and size refusal" { defer gpa.free(empty); try std.testing.expectEqual(@as(usize, 0), empty.len); p.update(.{ .output = .{ .pane = 0, .bytes = "limited terminal output" } }); - const expected = "limited terminal output"; + const expected = "limited terminal output\n"; // a line ends with its newline const bytes = try readLimit(p, path, expected.len); defer gpa.free(bytes); try std.testing.expectEqualStrings(expected, bytes); @@ -1270,6 +1277,15 @@ pub const Namespace = struct { /// What went wrong performing a write's effects after it was answered /// by the core (a save the host could not do): the 9P write, which /// waits for them, fails with it (src/9p_io.zig). + /// A header tag truncated by an open not yet released (ninep/cols.zig): + /// 0 the workspace's, a column's its index + 1; and whether the newline + /// that ended its last write is held back. + header_rewrite: ?u32 = null, + /// A look or exec a 9P write made found every pane slot taken; the + /// write fails with what was said, kept at the head of `ename`. + no_pane_slot: bool = false, + no_pane_slot_len: u16 = 0, + header_held: bool = false, late_failure: [256]u8 = undefined, late_failure_len: u16 = 0, /// A refusal that quotes the message it refuses, as Plan 9's cmderror @@ -1355,3 +1371,7 @@ pub fn unmount(p: *Pardes, name: []const u8) !void { test { _ = tree; } + +test "the tree's README lists src/ only when the build serves it" { + try std.testing.expectEqual(limits.embedded_sources, std.mem.indexOf(u8, help, "src/") != null); +} |
