Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libcurses/director tests/libcurses: fix off-by-one...



details:   https://anonhg.NetBSD.org/src/rev/84d1b45afb2e
branches:  trunk
changeset: 959347:84d1b45afb2e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Feb 08 23:54:03 2021 +0000

description:
tests/libcurses: fix off-by-one error in line numbers in diagnostics

I had broken this in testlang_parse.y 1.22 from 2021-02-07, when I
extracted the common 'eol' from the statements.  Extracting 'eol' had
the effect that the action for the statement was run before the line
number increased.

Now the line numbers in the diagnostics are the same again as before.

For lines that end with a backslash, the reported line number is the one
from the last of these lines, not the first one, also as before.  This
feature is not used by any of the current tests though.

diffstat:

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

diffs (47 lines):

diff -r 88a2af98d0c2 -r 84d1b45afb2e tests/lib/libcurses/director/testlang_conf.l
--- a/tests/lib/libcurses/director/testlang_conf.l      Mon Feb 08 23:50:25 2021 +0000
+++ b/tests/lib/libcurses/director/testlang_conf.l      Mon Feb 08 23:54:03 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/*     $NetBSD: testlang_conf.l,v 1.17 2021/02/08 19:15:20 rillig Exp $        */
+/*     $NetBSD: testlang_conf.l,v 1.18 2021/02/08 23:54:03 rillig Exp $        */
 
 /*-
  * Copyright 2009 Brett Lymn <blymn%NetBSD.org@localhost>
@@ -212,7 +212,7 @@
                cur_file = strdup(inc_file);
                if (cur_file == NULL)
                        err(2, "Cannot allocate new include file string");
-               line = 0;
+               line = 1;
                BEGIN(INITIAL);
        }
 
diff -r 88a2af98d0c2 -r 84d1b45afb2e tests/lib/libcurses/director/testlang_parse.y
--- a/tests/lib/libcurses/director/testlang_parse.y     Mon Feb 08 23:50:25 2021 +0000
+++ b/tests/lib/libcurses/director/testlang_parse.y     Mon Feb 08 23:54:03 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/*     $NetBSD: testlang_parse.y,v 1.42 2021/02/08 20:55:42 rillig Exp $       */
+/*     $NetBSD: testlang_parse.y,v 1.43 2021/02/08 23:54:03 rillig Exp $       */
 
 /*-
  * Copyright 2009 Brett Lymn <blymn%NetBSD.org@localhost>
@@ -60,7 +60,7 @@
 
 int yylex(void);
 
-size_t line;
+size_t line = 1;
 
 static int input_delay;
 
@@ -1433,7 +1433,7 @@
                }
                free(command.args);
        } else {
-               line = 0;
+               line = 1;
                input_delay = 0;
                vars = NULL;
                nvars = 0;



Home | Main Index | Thread Index | Old Index