Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libcurses When mvscanw(3) fails, string is not mod...



details:   https://anonhg.NetBSD.org/src/rev/81a4f020569e
branches:  trunk
changeset: 982193:81a4f020569e
user:      rin <rin%NetBSD.org@localhost>
date:      Sun Apr 04 09:42:08 2021 +0000

description:
When mvscanw(3) fails, string is not modified.
Let's ignore the 2nd result for this case.

diffstat:

 tests/lib/libcurses/slave/curses_commands.c |  11 ++++++++---
 tests/lib/libcurses/tests/mvscanw           |   2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r 1fba220d2322 -r 81a4f020569e tests/lib/libcurses/slave/curses_commands.c
--- a/tests/lib/libcurses/slave/curses_commands.c       Sun Apr 04 09:34:24 2021 +0000
+++ b/tests/lib/libcurses/slave/curses_commands.c       Sun Apr 04 09:42:08 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: curses_commands.c,v 1.23 2021/04/04 09:34:24 rin Exp $ */
+/*     $NetBSD: curses_commands.c,v 1.24 2021/04/04 09:42:08 rin Exp $ */
 
 /*-
  * Copyright 2009 Brett Lymn <blymn%NetBSD.org@localhost>
@@ -1980,6 +1980,7 @@
 void
 cmd_mvscanw(int nargs, char **args)
 {
+       int ret;
        char string[256];
 
        ARGC(3);
@@ -1988,8 +1989,12 @@
        ARG_STRING(2, fmt);     /* Must have a single "%s" in this test. */
 
        report_count(2);
-       report_return(mvscanw(y, x, fmt, string));
-       report_status(string);
+       report_return(ret = mvscanw(y, x, fmt, string));
+       /*
+        * When mvscanw(3) fails, string is not modified.
+        * Let's ignore the 2nd result for this case.
+        */
+       report_status(ret == ERR ? "ERR" : string);
 }
 
 
diff -r 1fba220d2322 -r 81a4f020569e tests/lib/libcurses/tests/mvscanw
--- a/tests/lib/libcurses/tests/mvscanw Sun Apr 04 09:34:24 2021 +0000
+++ b/tests/lib/libcurses/tests/mvscanw Sun Apr 04 09:42:08 2021 +0000
@@ -8,4 +8,4 @@
 call2 OK "2" mvscanw 3 5 "%d"
 input "aa bb 50 12\n"
 # expect ERR because input has alpha and scanw wants integer
-call2 ERR "2" mvscanw 3 5 "%d"
+call2 ERR "ERR" mvscanw 3 5 "%d"



Home | Main Index | Thread Index | Old Index