summaryrefslogtreecommitdiff
path: root/src/daemon.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon.zig')
-rw-r--r--src/daemon.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/daemon.zig b/src/daemon.zig
index f02c339e..84c77f90 100644
--- a/src/daemon.zig
+++ b/src/daemon.zig
@@ -1232,3 +1232,13 @@ test "a message carries its words and its fds, and the peer's end is null" {
_ = libc.close(pair[1]);
try std.testing.expect(recv(pair[0], &buf) == null);
}
+
+test "an attach by a name longer than any session's is refused in words, never an empty reason" {
+ var d: Daemon = .{};
+ var why: [512]u8 = undefined;
+ const long: []const u8 = &@as([600]u8, @splat('n'));
+ try std.testing.expect(d.find(.tty, long, &why) == null);
+ const said = std.mem.sliceTo(&why, 0);
+ try std.testing.expect(std.mem.startsWith(u8, said, "no "));
+ try std.testing.expect(said.len > "no ".len);
+}