Source-Changes-HG archive

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

[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: add test coverage for ...



details:   https://anonhg.NetBSD.org/src/rev/c51876003b87
branches:  trunk
changeset: 984456:c51876003b87
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jul 08 18:02:22 2021 +0000

description:
tests/lint: add test coverage for some parse errors

diffstat:

 tests/usr.bin/xlint/lint1/msg_249.c   |  23 ++++++++++++++++++++++-
 tests/usr.bin/xlint/lint1/msg_249.exp |   4 +++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diffs (47 lines):

diff -r 26079bc7223c -r c51876003b87 tests/usr.bin/xlint/lint1/msg_249.c
--- a/tests/usr.bin/xlint/lint1/msg_249.c       Thu Jul 08 15:44:44 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_249.c       Thu Jul 08 18:02:22 2021 +0000
@@ -1,9 +1,27 @@
-/*     $NetBSD: msg_249.c,v 1.3 2021/06/19 16:05:07 rillig Exp $       */
+/*     $NetBSD: msg_249.c,v 1.4 2021/07/08 18:02:22 rillig Exp $       */
 # 3 "msg_249.c"
 
 // Test for message: syntax error '%s' [249]
 
 /*
+ * Cover the grammar rule 'top_level_declaration: error T_SEMI'.
+ */
+/* expect+1: syntax error '"' [249] */
+"syntax error in top_level_declaration";
+
+/* XXX: This is necessary to recover the yacc parser. */
+int recover_from_semi;
+
+/*
+ * Cover the grammar rule 'top_level_declaration: error T_RBRACE'.
+ */
+/* expect+1: syntax error '"' [249] */
+"syntax error in top_level_declaration"}
+
+/* XXX: This is necessary to recover the yacc parser. */
+int recover_from_rbrace;
+
+/*
  * Before func.c 1.110 from 2021-06-19, lint ran into this:
  * assertion "cstmt->c_kind == kind" failed in end_control_statement
  */
@@ -14,3 +32,6 @@
                ;
        );                      /* expect: syntax error ')' */
 }
+
+/* XXX: This is necessary to recover the yacc parser. */
+int recover_from_rparen;
diff -r 26079bc7223c -r c51876003b87 tests/usr.bin/xlint/lint1/msg_249.exp
--- a/tests/usr.bin/xlint/lint1/msg_249.exp     Thu Jul 08 15:44:44 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_249.exp     Thu Jul 08 18:02:22 2021 +0000
@@ -1,1 +1,3 @@
-msg_249.c(15): error: syntax error ')' [249]
+msg_249.c(10): error: syntax error '"' [249]
+msg_249.c(19): error: syntax error '"' [249]
+msg_249.c(33): error: syntax error ')' [249]



Home | Main Index | Thread Index | Old Index