Module Name: src
Committed By: rillig
Date: Sun Feb 7 20:40:06 UTC 2021
Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l testlang_parse.y
src/tests/lib/libcurses/tests: keyname
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libcurses/director/testlang_conf.l
cvs rdiff -u -r1.31 -r1.32 src/tests/lib/libcurses/director/testlang_parse.y
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libcurses/tests/keyname
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/director/testlang_conf.l
diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.15 src/tests/lib/libcurses/director/testlang_conf.l:1.16
--- src/tests/lib/libcurses/director/testlang_conf.l:1.15 Sun Feb 7 20:32:25 2021
+++ src/tests/lib/libcurses/director/testlang_conf.l Sun Feb 7 20:40:05 2021
@@ -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 <[email protected]>
@@ -164,6 +164,7 @@ RPAREN \)
LBRACK \[
RBRACK \]
MULTIPLIER \*
+COMMA ,
%x incl
%option noinput nounput
@@ -245,6 +246,7 @@ include BEGIN(incl);
{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;
Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.31 src/tests/lib/libcurses/director/testlang_parse.y:1.32
--- src/tests/lib/libcurses/director/testlang_parse.y:1.31 Sun Feb 7 19:44:34 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y Sun Feb 7 20:40:05 2021
@@ -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 <[email protected]>
@@ -190,6 +190,7 @@ extern saved_data_t saved_output;
%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 @@ array : numeric {
(void *) $1);
}
}
- | array array
+ | array COMMA array
;
expr : numeric
Index: src/tests/lib/libcurses/tests/keyname
diff -u src/tests/lib/libcurses/tests/keyname:1.2 src/tests/lib/libcurses/tests/keyname:1.3
--- src/tests/lib/libcurses/tests/keyname:1.2 Sat Oct 24 04:46:17 2020
+++ src/tests/lib/libcurses/tests/keyname Sun Feb 7 20:40:06 2021
@@ -3,7 +3,7 @@ call "^C" keyname 0x03
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