From ca28d0a78f6bd4feea831911c982606363ffe844 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Mon, 30 Dec 2024 00:10:59 +0100 Subject: [PATCH] Add missing test for Vi mode $ PR #10953 reports missing coverage for the change to update_buff_pos() in d51f669647 (Vi mode: avoid placing cursor beyond last character, 2024-02-14). Add a case demonstrating how $ should not move the cursor past the last character. Goes without saying that it's really ugly that we update_buff_pos() must be so defensive here, ideally we wouldn't pass it out-of-bounds positions. --- tests/pexpects/bind.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/pexpects/bind.py b/tests/pexpects/bind.py index c42e0e7e0..d1588464f 100644 --- a/tests/pexpects/bind.py +++ b/tests/pexpects/bind.py @@ -241,6 +241,12 @@ expect_prompt("foo") # send("hh~~bbve~\r") # expect_prompt(TO_END + "SOME TeXT\r\n", unmatched="Couldn't find expected output 'SOME TeXT") +send("echo 125") +send("\033") +sleep(0.200) +send("0$i34\r") +expect_prompt("echo 12345") + # Now test that exactly the expected bind modes are defined sendline("bind --list-modes") expect_prompt(