diff options
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index ccba342e..db37fa49 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1990,6 +1990,17 @@ test "every EINVAL a write gets says why, in its err record too; DEL is a contro try testing.expect(th.logHas(p, "an empty name")); } +test "/index shows a name as the log does: a newline in it is \\n, controls spaces, bytes not UTF-8 \\xNN" { + const p = try th.withTerm(testing.allocator); + defer p.deinit(); + const term = p.paneBySerial(serialOf(p)).?; + p.setCwd(term, "/tmp/two\nlines\x7f\xff"); + const index = rd(p, @intFromEnum(tree.TopFile.index), 0, 4096).bytes; + try testing.expect(std.mem.indexOf(u8, index, "/tmp/two\\nlines \\xff ") != null); + try testing.expectEqual(@as(usize, 1), std.mem.count(u8, index, "\n")); + try testing.expectEqual(@as(u64, index.len), call(p, .{ .tag = 1, .op = .getattr, .node = @intFromEnum(tree.TopFile.index) }).reply.attr.size); +} + test "size is monotonic: growing is never refused, and a size once taken is taken again" { const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 60 }); defer p.deinit(); |
