summaryrefslogtreecommitdiff
path: root/test/behaviour/limits.zig
blob: 08c864eb6801e430952ddcf5ecafc888bc2b4876 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! docs/typ/reference.typ, Limits <limits>.
const std = @import("std");
const Session = @import("session").Session;

test "limits: a builtin that needs a pane says so when every slot is taken" {
    var s = try Session.initFile(std.testing.allocator, "x\n");
    defer s.deinit();
    const n = try s.focused();
    // Room on the screen for every pane, so the slots run out first.
    s.detach();
    try s.write("/ctl", "size 100 400\n");
    var made: usize = 1;
    while (s.newPane()) |_| made += 1 else |_| {}
    try std.testing.expectEqual(@as(usize, 64), made);
    _ = try s.refused(s.at("/pane/{d}/exec", .{n}), "Help\n");
    try std.testing.expectEqualStrings("help: no space for a pane: 64 max", s.said);
    try std.testing.expect(std.mem.indexOf(u8, try s.read("/log"), "help: no space for a pane") != null);
}