aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_osc5577.py
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-18 21:26:00 +0200
committeruser <user@clank>2026-08-18 21:26:00 +0200
commitb9e53cace4eb75263077df8623b011e66f5f2241 (patch)
tree78e4dfb23f5d1881dc7bfe9e4c96fd543bdfab0b /tests/test_osc5577.py
parentsl0ppty: aim the top handle at the middle, and stop ruling through the row (diff)
downloadslosh-b9e53cace4eb75263077df8623b011e66f5f2241.tar.gz
slosh-b9e53cace4eb75263077df8623b011e66f5f2241.tar.xz
slosh-b9e53cace4eb75263077df8623b011e66f5f2241.zip
slosh: rename the project from sl0ppty
sl0p + pty was error-prone to type and the zero made it worse; slosh (slop + sh) is one syllable, impossible to typo, and slosh.foo is ours. Mechanical rename everywhere it appears: binary, env vars (SLOSH, SLOSH_SESSION, SLOSH_BIN, SLOSH_CONFIG), socket dir (/tmp/slosh-<uid>, $XDG_RUNTIME_DIR/slosh), config path (~/.config/slosh), header guards, src/sl0ppty.h -> src/slosh.h, contrib/sl0ppty-dev -> contrib/slosh-dev, the driving-slosh skill, docs and tests. The sl0ppi fork references and the sl0p theme stay: one is history, the other is the brand. The rename surfaced a latent bug in test_osc5577: the hello-reply answer always appeared on screen twice (ECHOCTL echo plus cat -v), but a seven-character implementation name happened to wrap the second copy across the 60-column boundary, so counting substrings in wrapped text found one and passed for the wrong reason. A five-character name moved the wrap and exposed it. The loop guard itself is correct -- with echo off before the request there is exactly one reply -- so the test now counts on de-wrapped text and tolerates the pane's own echo.
Diffstat (limited to '')
-rw-r--r--tests/test_osc5577.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/test_osc5577.py b/tests/test_osc5577.py
index 64631c4..0a58b5b 100644
--- a/tests/test_osc5577.py
+++ b/tests/test_osc5577.py
@@ -346,7 +346,7 @@ def test_hello_handshake():
out = s.snapshot().pane_text(s.pane())
check(
"hello is answered with an implementation and a version",
- "5577;1;hello-reply;sl0ppty;1" in out,
+ "5577;1;hello-reply;slosh;1" in out,
repr(out[:120]),
)
@@ -364,10 +364,18 @@ def test_a_reply_is_not_a_request():
s.settle()
time.sleep(0.5) # real time: a loop needs none of our help to run
out = s.snapshot().pane_text(s.pane())
+ # The one answer can appear on screen twice: `cat -v` prints it, and if
+ # it arrived before the pane's `stty -echo` took effect, ECHOCTL echoed
+ # it too, as the same printable `^[`. Both are one reply, displayed by
+ # the pane's own doing; a loop is hundreds. Count on de-wrapped text --
+ # at 60 columns the second copy can straddle a line break, which is how
+ # a seven-character implementation name hid it from this count and made
+ # `== 1` pass for the wrong reason.
+ n = out.replace("\n", "").count("hello-reply")
check(
"a reply the pane echoes back is not answered again",
- out.count("hello-reply") == 1,
- repr(out[:200]),
+ 1 <= n <= 2,
+ "%d copies: %r" % (n, out[:200]),
)
check(
"and the pane is still usable afterwards",