Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libcurses/tests tests/libcurses: add test for '\b'...



details:   https://anonhg.NetBSD.org/src/rev/87f66317704e
branches:  trunk
changeset: 953059:87f66317704e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Feb 25 01:07:43 2021 +0000

description:
tests/libcurses: add test for '\b' in addch

Just to ensure that addch and addstr behave the same, after the recent
fix for handling '\t'.

diffstat:

 tests/lib/libcurses/tests/addbytes |   6 ++++--
 tests/lib/libcurses/tests/addch    |  28 +++++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 3 deletions(-)

diffs (65 lines):

diff -r 8c76e1b05dde -r 87f66317704e tests/lib/libcurses/tests/addbytes
--- a/tests/lib/libcurses/tests/addbytes        Thu Feb 25 00:50:10 2021 +0000
+++ b/tests/lib/libcurses/tests/addbytes        Thu Feb 25 01:07:43 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: addbytes,v 1.3 2021/02/25 00:26:57 rillig Exp $
+# $NetBSD: addbytes,v 1.4 2021/02/25 01:07:43 rillig Exp $
 #
 # Tests adding bytes to stdscr.
 #
@@ -19,13 +19,15 @@
 call OK addbytes "\n" 1
 call2 1 0 getyx STDSCR
 
+# Ensure that backspace works as intended.
+# See tests/addch.
 call OK addbytes "12345\010" 6
 call2 1 4 getyx STDSCR
 
 call OK addbytes "\010\010\010\010" 4
 call2 1 0 getyx STDSCR
 
-# When curx is already 0, backspace is a no-op.
+# If curx is already 0, backspace is a no-op.
 call OK addbytes "\010" 1
 call2 1 0 getyx STDSCR
 
diff -r 8c76e1b05dde -r 87f66317704e tests/lib/libcurses/tests/addch
--- a/tests/lib/libcurses/tests/addch   Thu Feb 25 00:50:10 2021 +0000
+++ b/tests/lib/libcurses/tests/addch   Thu Feb 25 01:07:43 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: addch,v 1.7 2021/02/14 11:21:37 rillig Exp $
+# $NetBSD: addch,v 1.8 2021/02/25 01:07:43 rillig Exp $
 #
 # Between at least 2012 and 2016, addstr did not advance win->curx for a '\t',
 # but addch did.  This was inconsistent.
@@ -33,3 +33,29 @@
 
 call OK refresh
 compare addch.chk
+
+# Ensure that backspace works as intended.
+# See tests/addbytes.
+call OK move 1 0
+call OK addstr "12345"
+call OK addch `\000\010`
+call2 1 4 getyx STDSCR
+
+call OK addch `\000\010`
+call OK addch `\000\010`
+call OK addch `\000\010`
+call OK addch `\000\010`
+call2 1 0 getyx STDSCR
+
+# If curx is already 0, backspace is a no-op.
+call OK addch `\000\010`
+call2 1 0 getyx STDSCR
+
+call OK addstr "123"
+call OK addch `\000\t`
+call2 1 8 getyx STDSCR
+
+# Backspace affects the cursor position, no matter whether the previously
+# output char was a tab or a space.
+call OK addch `\000\010`
+call2 1 7 getyx STDSCR



Home | Main Index | Thread Index | Old Index