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/libcurses: fix grammar for arrays



details:   https://anonhg.NetBSD.org/src/rev/fc7b2a82fbc8
branches:  trunk
changeset: 951933:fc7b2a82fbc8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 07 20:40:05 2021 +0000

description:
tests/libcurses: fix grammar for arrays

Previously, commas were completely ignored by the grammar.  Erroring out
on invalid characters made some of the tests fail since the comma was
not recognized anymore.  Add it back, but only for defining arrays.  It
would have been possible to leave out the commas or make them optional,
but since the current tests do not make use of that, keep the grammar as
strict as possible.

Fix an unclosed string literal in a test.  This had been wrongly
accepted before by the grammar.

diffstat:

 tests/lib/libcurses/director/testlang_conf.l  |  4 +++-
 tests/lib/libcurses/director/testlang_parse.y |  5 +++--
 tests/lib/libcurses/tests/keyname             |  2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diffs (65 lines):

diff -r 1e023d966559 -r fc7b2a82fbc8 tests/lib/libcurses/director/testlang_conf.l
--- a/tests/lib/libcurses/director/testlang_conf.l      Sun Feb 07 20:32:25 2021 +0000
+++ b/tests/lib/libcurses/director/testlang_conf.l      Sun Feb 07 20:40:05 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/*     $NetBSD: testlang_conf.l,v 1.15 2021/02/07 20:32:25 rillig Exp $        */
+/*     $NetBSD: testlang_conf.l,v 1.16 2021/02/07 20:40:05 rillig Exp $        */
 
 /*-
  * Copyright 2009 Brett Lymn <blymn%NetBSD.org@localhost>
@@ -164,6 +164,7 @@
 LBRACK         \[
 RBRACK         \]
 MULTIPLIER     \*
+COMMA          ,
 
 %x incl
 %option noinput nounput
@@ -245,6 +246,7 @@
 {OK_RET}       return OK_RET;
 {ERR_RET}      return ERR_RET;
 {MULTIPLIER}   return MULTIPLIER;
+{COMMA}                return COMMA;
 {CCHAR}                return CCHAR;
 {WCHAR}                return WCHAR;
 {OR}           return OR;
diff -r 1e023d966559 -r fc7b2a82fbc8 tests/lib/libcurses/director/testlang_parse.y
--- a/tests/lib/libcurses/director/testlang_parse.y     Sun Feb 07 20:32:25 2021 +0000
+++ b/tests/lib/libcurses/director/testlang_parse.y     Sun Feb 07 20:40:05 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/*     $NetBSD: testlang_parse.y,v 1.31 2021/02/07 19:44:34 rillig Exp $       */
+/*     $NetBSD: testlang_parse.y,v 1.32 2021/02/07 20:40:05 rillig Exp $       */
 
 /*-
  * Copyright 2009 Brett Lymn <blymn%NetBSD.org@localhost>
@@ -190,6 +190,7 @@
 %token <string> CCHAR
 %token <string> WCHAR
 %token EOL CALL CHECK NOINPUT OR MULTIPLIER LPAREN RPAREN LBRACK RBRACK
+%token COMMA
 %token CALL2 CALL3 CALL4 DRAIN
 
 %nonassoc OR
@@ -534,7 +535,7 @@
                                    (void *) $1);
                        }
                }
-               | array array
+               | array COMMA array
                ;
 
 expr           : numeric
diff -r 1e023d966559 -r fc7b2a82fbc8 tests/lib/libcurses/tests/keyname
--- a/tests/lib/libcurses/tests/keyname Sun Feb 07 20:32:25 2021 +0000
+++ b/tests/lib/libcurses/tests/keyname Sun Feb 07 20:40:05 2021 +0000
@@ -3,7 +3,7 @@
 call "C" keyname 0x43
 call "^?" keyname 0x7f
 call "M-^C" keyname 0x83
-call "M-C" keyname "0xc3
+call "M-C" keyname 0xc3
 call "M-^?" keyname 0xff
 call "KEY_RIGHT" keyname $KEY_RIGHT
 call "UNKNOWN KEY" keyname 0x205



Home | Main Index | Thread Index | Old Index