Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libcurses/slave tests/libcurses: query function ar...



details:   https://anonhg.NetBSD.org/src/rev/7c47c1f6d7d6
branches:  trunk
changeset: 952312:7c47c1f6d7d6
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Feb 12 20:41:37 2021 +0000

description:
tests/libcurses: query function arguments in consistent order

diffstat:

 tests/lib/libcurses/slave/curses_commands.c |   82 +++++++++++++++------
 tests/lib/libcurses/slave/lint.lua          |  103 ++++++++++++++++++++++++++++
 2 files changed, 160 insertions(+), 25 deletions(-)

diffs (truncated from 537 to 300 lines):

diff -r 68cd56af68c6 -r 7c47c1f6d7d6 tests/lib/libcurses/slave/curses_commands.c
--- a/tests/lib/libcurses/slave/curses_commands.c       Fri Feb 12 19:57:49 2021 +0000
+++ b/tests/lib/libcurses/slave/curses_commands.c       Fri Feb 12 20:41:37 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: curses_commands.c,v 1.19 2021/02/12 18:20:05 rillig Exp $      */
+/*     $NetBSD: curses_commands.c,v 1.20 2021/02/12 20:41:37 rillig Exp $      */
 
 /*-
  * Copyright 2009 Brett Lymn <blymn%NetBSD.org@localhost>
@@ -150,6 +150,16 @@
        if (set_scrn(args[i], &arg) != 0)                               \
                return
 
+/*
+ * Required by the API, intended for future extensions, but this
+ * implementation does not support the extension.
+ */
+#define ARG_NULL(i) \
+       (void)0
+
+#define ARG_IGNORE(i) \
+       (void)0
+
 void
 cmd_DRAIN(int nargs, char **args)
 {
@@ -391,7 +401,7 @@
 {
        ARGC(2);
        ARG_SHORT(0, colour_pair);
-       /* TODO: arg 1 */
+       ARG_NULL(1);
 
        report_count(1);
        report_return(color_set(colour_pair, NULL));
@@ -1947,8 +1957,8 @@
        ARGC(4);
        ARG_INT(0, y);
        ARG_INT(1, x);
+       ARG_CHTYPE(2, ch);
        ARG_INT(3, n);
-       ARG_CHTYPE(2, ch);
 
        report_count(1);
        report_return(mvhline(y, x, ch, n));
@@ -1991,8 +2001,8 @@
        ARGC(4);
        ARG_INT(0, y);
        ARG_INT(1, x);
+       ARG_CHTYPE(2, ch);
        ARG_INT(3, n);
-       ARG_CHTYPE(2, ch);
 
        report_count(1);
        report_return(mvvline(y, x, ch, n));
@@ -2006,8 +2016,8 @@
        ARG_WINDOW(0, win);
        ARG_INT(1, y);
        ARG_INT(2, x);
+       ARG_CHTYPE(3, ch);
        ARG_INT(4, n);
-       ARG_CHTYPE(3, ch);
 
        report_count(1);
        report_return(mvwhline(win, y, x, ch, n));
@@ -2021,8 +2031,8 @@
        ARG_WINDOW(0, win);
        ARG_INT(1, y);
        ARG_INT(2, x);
+       ARG_CHTYPE(3, ch);
        ARG_INT(4, n);
-       ARG_CHTYPE(3, ch);
 
        report_count(1);
        report_return(mvwvline(win, y, x, ch, n));
@@ -3007,7 +3017,7 @@
        ARGC(3);
        ARG_WINDOW(0, win);
        ARG_SHORT(1, pair);
-       /* TODO: arg 2 */
+       ARG_NULL(2);
 
        report_count(1);
        report_return(wcolor_set(win, pair, NULL));
@@ -3107,8 +3117,8 @@
 {
        ARGC(3);
        ARG_WINDOW(0, win);
+       ARG_CHTYPE(1, ch);
        ARG_INT(2, count);
-       ARG_CHTYPE(1, ch);
 
        report_count(1);
        report_return(whline(win, ch, count));
@@ -3409,8 +3419,8 @@
 {
        ARGC(3);
        ARG_WINDOW(0, win);
+       ARG_CHTYPE(1, ch);
        ARG_INT(2, n);
-       ARG_CHTYPE(1, ch);
 
        report_count(1);
        report_return(wvline(win, ch, n));
@@ -3530,8 +3540,8 @@
        ARG_INT(0, n);
        ARG_INT(1, attr);
        ARG_INT(2, colour);
-
-       /* Note: 4th argument unused in current curses implementation */
+       ARG_NULL(3);
+
        report_count(1);
        report_return(chgat(n, attr, colour, NULL));
 }
@@ -3545,6 +3555,7 @@
        ARG_INT(1, n);
        ARG_INT(2, attr);
        ARG_SHORT(3, colour);
+       ARG_NULL(4);
 
        report_count(1);
        report_return(wchgat(win, n, attr, colour, NULL));
@@ -3560,6 +3571,7 @@
        ARG_INT(2, n);
        ARG_INT(3, attr);
        ARG_SHORT(4, colour);
+       ARG_NULL(5);
 
        report_count(1);
        report_return(mvchgat(y, x, n, attr, colour, NULL));
@@ -3576,6 +3588,7 @@
        ARG_INT(3, n);
        ARG_INT(4, attr);
        ARG_SHORT(5, colour);
+       ARG_NULL(6);
 
        report_count(1);
        report_return(mvwchgat(win, y, x, n, attr, colour, NULL));
@@ -3637,6 +3650,7 @@
 cmd_add_wchnstr(int nargs, char **args)
 {
        ARGC(1);
+       ARG_IGNORE(0);
 
        report_count(1);
        report_error("UNSUPPORTED");
@@ -3647,6 +3661,7 @@
 cmd_add_wchstr(int nargs, char **args)
 {
        ARGC(1);
+       ARG_IGNORE(0);
 
        report_count(1);
        report_error("UNSUPPORTED");
@@ -3657,6 +3672,7 @@
 cmd_wadd_wchnstr(int nargs, char **args)
 {
        ARGC(1);
+       ARG_IGNORE(0);
 
        report_count(1);
        report_error("UNSUPPORTED");
@@ -3667,6 +3683,7 @@
 cmd_wadd_wchstr(int nargs, char **args)
 {
        ARGC(1);
+       ARG_IGNORE(0);
 
        report_count(1);
        report_error("UNSUPPORTED");
@@ -3677,6 +3694,7 @@
 cmd_mvadd_wchnstr(int nargs, char **args)
 {
        ARGC(1);
+       ARG_IGNORE(0);
 
        report_count(1);
        report_error("UNSUPPORTED");
@@ -3687,6 +3705,7 @@
 cmd_mvadd_wchstr(int nargs, char **args)
 {
        ARGC(1);
+       ARG_IGNORE(0);
 
        report_count(1);
        report_error("UNSUPPORTED");
@@ -3697,6 +3716,7 @@
 cmd_mvwadd_wchnstr(int nargs, char **args)
 {
        ARGC(1);
+       ARG_IGNORE(0);
 
        report_count(1);
        report_error("UNSUPPORTED");
@@ -3707,6 +3727,7 @@
 cmd_mvwadd_wchstr(int nargs, char **args)
 {
        ARGC(1);
+       ARG_IGNORE(0);
 
        report_count(1);
        report_error("UNSUPPORTED");
@@ -3743,8 +3764,8 @@
        ARGC(4);
        ARG_INT(0, y);
        ARG_INT(1, x);
+       ARG_WCHAR_STRING(2, wstr);
        ARG_INT(3, n);
-       ARG_WCHAR_STRING(2, wstr);
 
        report_count(1);
        report_return(mvaddnwstr(y, x, wstr, n));
@@ -3771,8 +3792,8 @@
        ARG_WINDOW(0, win);
        ARG_INT(1, y);
        ARG_INT(2, x);
+       ARG_WCHAR_STRING(3, wstr);
        ARG_INT(4, n);
-       ARG_WCHAR_STRING(3, wstr);
 
        report_count(1);
        report_return(mvwaddnwstr(win, y, x, wstr, n));
@@ -3798,8 +3819,8 @@
 {
        ARGC(3);
        ARG_WINDOW(0, win);
+       ARG_WCHAR_STRING(1, wstr);
        ARG_INT(2, n);
-       ARG_WCHAR_STRING(1, wstr);
 
        report_count(1);
        report_return(waddnwstr(win, wstr, n));
@@ -3936,8 +3957,8 @@
        ARGC(4);
        ARG_INT(0, y);
        ARG_INT(1, x);
+       ARG_WCHAR_STRING(2, wstr);
        ARG_INT(3, n);
-       ARG_WCHAR_STRING(2, wstr);
 
        report_count(1);
        report_return(mvins_nwstr(y, x, wstr, n));
@@ -3964,8 +3985,8 @@
        ARG_WINDOW(0, win);
        ARG_INT(1, y);
        ARG_INT(2, x);
+       ARG_WCHAR_STRING(3, wstr);
        ARG_INT(4, n);
-       ARG_WCHAR_STRING(3, wstr);
 
        report_count(1);
        report_return(mvwins_nwstr(win, y, x, wstr, n));
@@ -3991,8 +4012,8 @@
 {
        ARGC(3);
        ARG_WINDOW(0, win);
+       ARG_WCHAR_STRING(1, wstr);
        ARG_INT(2, n);
-       ARG_WCHAR_STRING(1, wstr);
 
        report_count(1);
        report_return(wins_nwstr(win, wstr, n));
@@ -4262,6 +4283,7 @@
 cmd_in_wchnstr(int nargs, char **args)
 {
        ARGC(1);
+       ARG_IGNORE(0);
 
        report_count(1);
        report_error("UNSUPPORTED");
@@ -4272,6 +4294,7 @@
 cmd_in_wchstr(int nargs, char **args)
 {
        ARGC(1);
+       ARG_IGNORE(0);
 
        report_count(1);
        report_error("UNSUPPORTED");
@@ -4282,6 +4305,7 @@
 cmd_mvin_wchnstr(int nargs, char **args)
 {
        ARGC(1);
+       ARG_IGNORE(0);
 
        report_count(1);
        report_error("UNSUPPORTED");
@@ -4292,6 +4316,7 @@
 cmd_mvin_wchstr(int nargs, char **args)
 {
        ARGC(1);
+       ARG_IGNORE(0);
 
        report_count(1);
        report_error("UNSUPPORTED");
@@ -4302,6 +4327,7 @@
 cmd_mvwin_wchnstr(int nargs, char **args)
 {
        ARGC(1);
+       ARG_IGNORE(0);



Home | Main Index | Thread Index | Old Index