From 34641e435fcbae0af578189760d5ebb05bc07f9a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 03:56:36 -0300 Subject: Term: a core without a terminal boots to a scratch pane, and a test skips only where it needs a terminal (docs/next-terminal.md, Phase 1, the no-terminal core): Pardes.init's shell boots (.shell, .classic, .tty, .tty_shell) are one scratch pane when Term.ops is null, so a test that booted a shell for convenience runs on it, where every one of them skipped before (Term.open refused with SkipZigTest under a test); Term.open refuses with error.NoTerminal, said by errorWords as Term.none, so Term and an exec no shell can take (a command pane) refuse in words (`Term: no terminal in this build`, `exec: ...`), and takesCommandLine is false with no terminal pane; a +Pager pages the bytes as they are (Term.page, unchanged); no boot message: the no-terminal core is a test build alone, read by no person, and a message at boot put seven core tests (the message log, the notice bands, the Del question's wake, a press on a column's rule) out of core-test; a test that fails for want of a terminal says so on its first line (`if (pardes.Term.ops == null) return error.SkipZigTest; // a shell`: a shell, a command pane, the classic boot's three shells, it reads the emulator, ...), 99 tests in 25 files, and ninep/testing.zig's withTerm, the fixture of 29 that assert a terminal pane, once; each attributed by its failure on the scratch boot (NoTerminal from newShell or newCommand, a shell's pane, prompt, pty bytes or tag asserted, the classic boot's panes indexed) and by reading its body; no assertion changes; test: Term.zig ends with the no-terminal core's three (each boot a scratch pane and no terminal; Term, newShell and an exec refused in words, no line typed at a shell; a program's output paged as plain text); core-test (no terminal) 411 passed / 535 skipped of 946 to 810 passed / 139 skipped of 949, shell-test 992: 989 passed, the three no-terminal tests skipped --- src/Core.zig | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'src/Core.zig') diff --git a/src/Core.zig b/src/Core.zig index ee4420ec..7c550d74 100644 --- a/src/Core.zig +++ b/src/Core.zig @@ -526,7 +526,17 @@ fn initSession(gpa: std.mem.Allocator, opts: Options) !*Pardes { p.boot = Boot.of(opts); // Asked once, at the start, whoever asks first after. _ = p.sessionDir(); - switch (p.boot) { + // A core built without a terminal (a test configuration: core-test's) + // boots to a scratch pane where a shell would have been, and says why + // once. + const shell_boot = switch (p.boot) { + .tty, .tty_shell, .shell, .classic => true, + .document, .missing, .stdin => false, + }; + if (pardes.Term.ops == null and shell_boot) { + _ = try pardes.panes.newScratch(p, 0, 0, .scratch); + p.oneColumn(); + } else switch (p.boot) { .document => { const path = opts.file.?; const opened = initial_doc: { @@ -2309,6 +2319,7 @@ test "topbar hover highlights exactly the executable word" { } test "pane-tag Exec prefers Term and argument builtins before shell fallback" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .cols = 100, .rows = 30 }); defer p.deinit(); @@ -2531,6 +2542,7 @@ test "Filter is ordered after Del and toggles only its terminal or +Pager pane" } test "compact tag commands stay beside their own prefix across layout changes" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .cols = 100, .rows = 30 }); defer p.deinit(); @@ -2575,6 +2587,7 @@ test "compact tag commands stay beside their own prefix across layout changes" { } test "Term spawns a raw shell in the caller's directory" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 100, .rows = 30 }); defer p.deinit(); @@ -2600,6 +2613,7 @@ test "Term spawns a raw shell in the caller's directory" { } test "a terminal respawned into a closed pane's slot hangs the old shell up first" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell // Hosts keep a shell per slot: were the spawn first, the close would // end the new shell and leave the old one running. const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 }); @@ -2670,6 +2684,7 @@ test "an empty column shows its theme's empty_col under its tag: acme's white, e } test "unknown Exec from a document runs as a command pane in its directory, typed into no terminal" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{}); defer p.deinit(); @@ -2697,6 +2712,7 @@ test "unknown Exec from a document runs as a command pane in its directory, type } test "Exec in a terminal whose tty is taken runs as a command pane instead of typing at the program" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{}); defer p.deinit(); @@ -2728,6 +2744,7 @@ test "Exec in a terminal whose tty is taken runs as a command pane instead of ty } test "a command of several lines keeps its tag one row, and its echo does not staircase" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 100, .rows = 30 }); defer p.deinit(); @@ -2754,6 +2771,7 @@ test "a command of several lines keeps its tag one row, and its echo does not st } test "a spawn is for the pane it was made for, not whatever took the slot since" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true }); defer p.deinit(); @@ -2784,6 +2802,7 @@ test "a spawn is for the pane it was made for, not whatever took the slot since" } test "a REPL bound for a language takes the exec made on a body in it; tags, Exec by name and command words still run" { + if (pardes.Term.ops == null) return error.SkipZigTest; // the classic boot's three shells const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .shells = 3, .cols = 100, .rows = 30 }); defer p.deinit(); @@ -3024,6 +3043,7 @@ test "a restored terminal's tag names neither the REPL it was nor the shell it h } test "a Term started by a shell's path keeps the path in its Term+ word" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); defer p.deinit(); while (p.nextEffect()) |_| {} @@ -3034,6 +3054,7 @@ test "a Term started by a shell's path keeps the path in its Term+ word" { } test "Tty, Term's old name in saved tags, runs as Term, bare and with its +shell" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); defer p.deinit(); while (p.nextEffect()) |_| {} @@ -3046,6 +3067,7 @@ test "Tty, Term's old name in saved tags, runs as Term, bare and with its +shell } test "Term+fish, one word a tag can hold, opens a terminal on that shell" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); defer p.deinit(); while (p.nextEffect()) |_| {} @@ -3075,6 +3097,7 @@ test "Term+fish, one word a tag can hold, opens a terminal on that shell" { } test "a command pane shows how its command ended, and the next command there runs below it" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{}); defer p.deinit(); @@ -3173,6 +3196,7 @@ test "a command pane shows how its command ended, and the next command there run } test "a terminal its program gave back takes command lines again" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{}); defer p.deinit(); @@ -3206,6 +3230,7 @@ test "a terminal its program gave back takes command lines again" { } test "the host is asked about a tty only where a command line is about to go" { + if (pardes.Term.ops == null) return error.SkipZigTest; // the classic boot's three shells const p = try Pardes.init(std.testing.allocator, .{ .shells = 3, .cols = 100, .rows = 30 }); defer p.deinit(); while (p.nextEffect()) |_| {} @@ -3369,6 +3394,7 @@ test "startup config overrides restored styling before initFromDump returns" { } test "restored terminals keep monotonic nonzero pane identities" { + if (pardes.Term.ops == null) return error.SkipZigTest; // the classic boot's three shells const gpa = std.testing.allocator; const source = try Pardes.init(gpa, .{ .shells = 3 }); defer source.deinit(); @@ -3663,6 +3689,7 @@ test "argv naming nothing boots an errors pane rather than failing the launch" { } test "raw terminal cursor obeys visibility without hiding modal and tag cursors" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }); defer p.deinit(); @@ -3707,6 +3734,7 @@ test "raw terminal cursor obeys visibility without hiding modal and tag cursors" } test "raw terminal cursor follows its active row only while that row is visible" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }); defer p.deinit(); @@ -3736,6 +3764,7 @@ test "raw terminal cursor follows its active row only while that row is visible" } test "the bare tty startup opens a text pane under the shell, unfocused" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .boot = .tty }); defer p.deinit(); try std.testing.expectEqual(Boot.tty, p.boot); @@ -3804,6 +3833,7 @@ test "tty output follows only from the bottom" { } test "an unasked desktop paste reaches a tty pane's program, not its buffer" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer p.deinit(); @@ -3822,6 +3852,7 @@ test "an unasked desktop paste reaches a tty pane's program, not its buffer" { } test "a paste larger than the effect ring reaches the program whole and in order" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer p.deinit(); @@ -3856,6 +3887,7 @@ test "bytes for a terminal past what may wait for it are dropped and said, never } test "a bracketed paste larger than the ring still closes its bracket" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer p.deinit(); @@ -3878,6 +3910,7 @@ test "a bracketed paste larger than the ring still closes its bracket" { } test "a terminal's answer to its program waits behind the paste still queued for its pty" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer p.deinit(); @@ -3904,6 +3937,7 @@ test "a terminal's answer to its program waits behind the paste still queued for } test "pasted bytes still queued at shutdown are freed, not leaked" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer p.deinit(); -- cgit v1.3