Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libcurses Add more testing for special character h...



details:   https://anonhg.NetBSD.org/src/rev/5199590348b3
branches:  trunk
changeset: 1026295:5199590348b3
user:      blymn <blymn%NetBSD.org@localhost>
date:      Tue Nov 16 21:02:06 2021 +0000

description:
Add more testing for special character handling in ins_wstr family.

diffstat:

 tests/lib/libcurses/check_files/Makefile       |   8 +++++-
 tests/lib/libcurses/check_files/ins_wstr3.chk  |   1 +
 tests/lib/libcurses/check_files/ins_wstr5.chk  |   1 +
 tests/lib/libcurses/check_files/wins_wstr3.chk |   1 +
 tests/lib/libcurses/check_files/wins_wstr4.chk |   1 +
 tests/lib/libcurses/check_files/wins_wstr5.chk |   1 +
 tests/lib/libcurses/tests/ins_wstr             |  28 +++++++++++++++++----
 tests/lib/libcurses/tests/wins_wstr            |  32 ++++++++++++++++++++++++++
 8 files changed, 66 insertions(+), 7 deletions(-)

diffs (133 lines):

diff -r 4616fe132cbf -r 5199590348b3 tests/lib/libcurses/check_files/Makefile
--- a/tests/lib/libcurses/check_files/Makefile  Tue Nov 16 21:01:05 2021 +0000
+++ b/tests/lib/libcurses/check_files/Makefile  Tue Nov 16 21:02:06 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.8 2021/11/15 06:31:21 blymn Exp $
+# $NetBSD: Makefile,v 1.9 2021/11/16 21:02:06 blymn Exp $
 
 NOMAN=         # defined
 
@@ -122,6 +122,9 @@
 FILES+=                ins_wch3.chk
 FILES+=                ins_wstr1.chk
 FILES+=                ins_wstr2.chk
+FILES+=                ins_wstr3.chk
+FILES+=                ins_wstr4.chk
+FILES+=                ins_wstr5.chk
 FILES+=                insch.chk
 FILES+=                insch1.chk
 FILES+=                insch2.chk
@@ -264,6 +267,9 @@
 FILES+=                wins_nwstr2.chk
 FILES+=                wins_wstr1.chk
 FILES+=                wins_wstr2.chk
+FILES+=                wins_wstr3.chk
+FILES+=                wins_wstr4.chk
+FILES+=                wins_wstr5.chk
 FILES+=                winsch1.chk
 FILES+=                winsch2.chk
 FILES+=                wprintw_refresh.chk
diff -r 4616fe132cbf -r 5199590348b3 tests/lib/libcurses/check_files/ins_wstr3.chk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libcurses/check_files/ins_wstr3.chk     Tue Nov 16 21:02:06 2021 +0000
@@ -0,0 +1,1 @@
+cup21;1XBB
\ No newline at end of file
diff -r 4616fe132cbf -r 5199590348b3 tests/lib/libcurses/check_files/ins_wstr5.chk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libcurses/check_files/ins_wstr5.chk     Tue Nov 16 21:02:06 2021 +0000
@@ -0,0 +1,1 @@
+F                      F
\ No newline at end of file
diff -r 4616fe132cbf -r 5199590348b3 tests/lib/libcurses/check_files/wins_wstr3.chk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libcurses/check_files/wins_wstr3.chk    Tue Nov 16 21:02:06 2021 +0000
@@ -0,0 +1,1 @@
+cup8;7XCcup8;7X
\ No newline at end of file
diff -r 4616fe132cbf -r 5199590348b3 tests/lib/libcurses/check_files/wins_wstr4.chk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libcurses/check_files/wins_wstr4.chk    Tue Nov 16 21:02:06 2021 +0000
@@ -0,0 +1,1 @@
+A㐁Acup5;7Xelcup6;7XAAcup7;7XD cup8;7X Ecup8;7X
\ No newline at end of file
diff -r 4616fe132cbf -r 5199590348b3 tests/lib/libcurses/check_files/wins_wstr5.chk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libcurses/check_files/wins_wstr5.chk    Tue Nov 16 21:02:06 2021 +0000
@@ -0,0 +1,1 @@
+FFGGcup8;7X
\ No newline at end of file
diff -r 4616fe132cbf -r 5199590348b3 tests/lib/libcurses/tests/ins_wstr
--- a/tests/lib/libcurses/tests/ins_wstr        Tue Nov 16 21:01:05 2021 +0000
+++ b/tests/lib/libcurses/tests/ins_wstr        Tue Nov 16 21:02:06 2021 +0000
@@ -20,9 +20,25 @@
 call2 10 10 getyx STDSCR
 compare ins_wstr2.chk
 
-# lib/55433: Bug in special character handling of ins_wstr() of libcurses
-# test special character processing [FAILING]
-# wchar NSTR ["A"*3, "\r", "B"*2]
-# call OK move 20 0
-# call OK ins_wstr $NSTR
-# call OK refresh
+# This should result in just BB
+wchar NSTR ["A"*3, "\r", "B"*2]
+call OK move 20 0
+call OK ins_wstr $NSTR
+call OK refresh
+compare ins_wstr3.chk
+
+# Check handling of tabs
+# first try inserting too many, it should fail
+wchar TSTR [ "\t"*20 ]
+call ERR ins_wstr $TSTR
+call OK refresh
+call2 20 0 getyx STDSCR
+compare ins_wstr4.chk
+
+# Now insert a few tabs...
+wchar USTR [ "F", "\t"*3, "F" ]
+call OK ins_wstr $USTR
+call OK refresh
+call2 20 0 getyx STDSCR
+compare ins_wstr5.chk
+
diff -r 4616fe132cbf -r 5199590348b3 tests/lib/libcurses/tests/wins_wstr
--- a/tests/lib/libcurses/tests/wins_wstr       Tue Nov 16 21:01:05 2021 +0000
+++ b/tests/lib/libcurses/tests/wins_wstr       Tue Nov 16 21:02:06 2021 +0000
@@ -16,3 +16,35 @@
 call OK wrefresh $win1
 call2 4 1 getyx $win1
 compare wins_wstr2.chk
+
+#
+# test the special character handling.
+#
+# handling of a carriage return
+wchar RSTR ["B", "\r", "C" ]
+call OK wmove $win1 5 1
+call OK wins_wstr $win1 $RSTR
+call OK wrefresh $win1
+call2 5 1 getyx $win1
+compare wins_wstr3.chk
+
+# handling of a newline
+wchar JSTR [ "D", "\n", "E" ]
+call OK wmove $win1 5 1
+# this should fail since scrollok is false
+call OK scrollok $win1 $FALSE
+call ERR wins_wstr $win1 $JSTR
+
+# try again after enabling scroll
+call OK scrollok $win1 $TRUE
+call OK wins_wstr $win1 $JSTR
+call OK wrefresh $win1
+call2 5 1 getyx $win1
+compare wins_wstr4.chk
+
+# handling of a backspace
+wchar BSTR [ "F"*3, "\b", "G"*2 ]
+call OK wins_wstr $win1 $BSTR
+call OK wrefresh $win1
+call2 5 1 getyx $win1
+compare wins_wstr5.chk


Home | Main Index | Thread Index | Old Index