summaryrefslogtreecommitdiff
path: root/tests.zig
diff options
context:
space:
mode:
Diffstat (limited to 'tests.zig')
-rw-r--r--tests.zig22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests.zig b/tests.zig
index 83e42dad..0a81feb6 100644
--- a/tests.zig
+++ b/tests.zig
@@ -589,4 +589,26 @@ pub fn main(init: std.process.Init) !void {
return error.ColumnCollapseReflow;
}
}
+
+ // 18. DEVICE-QUERY REPLIES: full-screen apps (nushell/reedline, helix, fzf — all
+ // crossterm) send a DSR cursor-position report (ESC[6n) at startup and BLOCK
+ // until the terminal answers. pardes must reply into the pty; without the
+ // write_pty effect the reply is dropped and the app spins forever ("nushell
+ // never opens"). Mode-independent. Run a command that (in raw mode, like a
+ // real app) emits ESC[6n and only echoes its marker AFTER it reads the reply
+ // — the marker appears only if pardes answered the query.
+ {
+ var hs8 = try Harness.init(gpa, exe.ptr, 24, 80);
+ defer hs8.deinit();
+ try hs8.expectWaitFor("build.zig", 8000, "fresh terminal never auto-ls'd");
+ try hs8.send("\x02"); // normal -> tty
+ try hs8.pump(600);
+ // -icanon so the reply's bytes reach `read` without a newline; read until the
+ // reply terminator 'R' (ESC[<row>;<col>R) with a timeout, and print the marker
+ // ONLY if the read SUCCEEDS (a reply arrived). The marker is split with ''
+ // so it appears solely in the command's OUTPUT, never in the echoed command
+ // line — otherwise the on-screen command text would false-match it.
+ try hs8.send("stty -icanon -echo min 1 time 0; printf '\\033[6n'; read -r -d R -t 3 _c && printf 'ZZCPR''OK\\n'; stty sane\r");
+ try hs8.expectWaitFor("ZZCPROK", 8000, "app blocked on its ESC[6n query — pardes dropped the reply (device queries not answered)");
+ }
}