Module Name: src Committed By: rillig Date: Thu Feb 25 01:07:43 UTC 2021
Modified Files: src/tests/lib/libcurses/tests: addbytes addch Log Message: 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'. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libcurses/tests/addbytes cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libcurses/tests/addch Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/lib/libcurses/tests/addbytes diff -u src/tests/lib/libcurses/tests/addbytes:1.3 src/tests/lib/libcurses/tests/addbytes:1.4 --- src/tests/lib/libcurses/tests/addbytes:1.3 Thu Feb 25 00:26:57 2021 +++ src/tests/lib/libcurses/tests/addbytes Thu Feb 25 01:07:43 2021 @@ -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 @@ call2 0 16 getyx STDSCR 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 Index: src/tests/lib/libcurses/tests/addch diff -u src/tests/lib/libcurses/tests/addch:1.7 src/tests/lib/libcurses/tests/addch:1.8 --- src/tests/lib/libcurses/tests/addch:1.7 Sun Feb 14 11:21:37 2021 +++ src/tests/lib/libcurses/tests/addch Thu Feb 25 01:07:43 2021 @@ -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 addch `\000\n` 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