Source-Changes-HG archive

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

[src/trunk]: src/tests/usr.bin/indent tests/indent: test edge cases for the t...



details:   https://anonhg.NetBSD.org/src/rev/979a7e504bb9
branches:  trunk
changeset: 1023741:979a7e504bb9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 25 12:20:44 2021 +0000

description:
tests/indent: test edge cases for the tokenizer

diffstat:

 distrib/sets/lists/tests/mi       |   5 +++-
 tests/usr.bin/indent/Makefile     |   5 +++-
 tests/usr.bin/indent/lex.0        |  40 +++++++++++++++++++++++++++++++++++++++
 tests/usr.bin/indent/lex.0.pro    |   4 +++
 tests/usr.bin/indent/lex.0.stdout |  21 ++++++++++++++++++++
 5 files changed, 73 insertions(+), 2 deletions(-)

diffs (115 lines):

diff -r ee78e8d277b6 -r 979a7e504bb9 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sat Sep 25 10:41:03 2021 +0000
+++ b/distrib/sets/lists/tests/mi       Sat Sep 25 12:20:44 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1127 2021/09/25 09:46:29 rillig Exp $
+# $NetBSD: mi,v 1.1128 2021/09/25 12:20:44 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4753,6 +4753,9 @@
 ./usr/tests/usr.bin/indent/label.0                                     tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/indent/label.0.pro                                 tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/indent/label.0.stdout                              tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/indent/lex.0                                       tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/indent/lex.0.pro                                   tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/indent/lex.0.stdout                                        tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/indent/lex_char.0                                  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/indent/lex_char.0.pro                              tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/indent/lex_char.0.stdout                           tests-usr.bin-tests     compattestfile,atf
diff -r ee78e8d277b6 -r 979a7e504bb9 tests/usr.bin/indent/Makefile
--- a/tests/usr.bin/indent/Makefile     Sat Sep 25 10:41:03 2021 +0000
+++ b/tests/usr.bin/indent/Makefile     Sat Sep 25 12:20:44 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.9 2021/09/25 09:46:29 rillig Exp $
+#      $NetBSD: Makefile,v 1.10 2021/09/25 12:20:44 rillig Exp $
 
 .include <bsd.own.mk>
 
@@ -30,6 +30,9 @@
 FILES+=                label.0
 FILES+=                label.0.stdout
 FILES+=                label.0.pro
+FILES+=                lex.0
+FILES+=                lex.0.pro
+FILES+=                lex.0.stdout
 FILES+=                lex_char.0
 FILES+=                lex_char.0.pro
 FILES+=                lex_char.0.stdout
diff -r ee78e8d277b6 -r 979a7e504bb9 tests/usr.bin/indent/lex.0
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/indent/lex.0        Sat Sep 25 12:20:44 2021 +0000
@@ -0,0 +1,40 @@
+/* $NetBSD: lex.0,v 1.1 2021/09/25 12:20:44 rillig Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Test lexing of tokens, such as keywords, identifiers, operators.
+ */
+
+/* GCC accepts this even with WARNS=6. */
+in\
+t \
+var\
+iable;
+
+int
+       no_backslash;
+
+/* $ See check_size_token. */
+/* $ The default buffer size is 200, the limit is 195. */
+struct long_tag_name_to_overflow_the_token_buffer_4567890\
+12345678901234567890123456789012345678901234567890\
+12345678901234567890123456789012345678901234567890\
+12345678901234567890123456789012345678901234567890;
+
+/* $ See check_size_token. */
+/* $ The difference between limit and start got incremented to 595. */
+struct long_tag_name_to_overflow_the_token_buffer_4567890\
+12345678901234567890123456789012345678901234567890\
+12345678901234567890123456789012345678901234567890\
+12345678901234567890123456789012345678901234567890\
+12345678901234567890123456789012345678901234567890\
+12345678901234567890123456789012345678901234567890\
+12345678901234567890123456789012345678901234567890\
+12345678901234567890123456789012345678901234567890\
+12345678901234567890123456789012345678901234567890\
+12345678901234567890123456789012345678901234567890\
+12345678901234567890123456789012345678901234567890\
+12345678901234567890123456789012345678901234567890;
+
+/* This is a syntax error; see lex_word. */
+int identifier\n;
diff -r ee78e8d277b6 -r 979a7e504bb9 tests/usr.bin/indent/lex.0.pro
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/indent/lex.0.pro    Sat Sep 25 12:20:44 2021 +0000
@@ -0,0 +1,4 @@
+/* $NetBSD: lex.0.pro,v 1.1 2021/09/25 12:20:44 rillig Exp $ */
+/* $FreeBSD$ */
+
+-di16
diff -r ee78e8d277b6 -r 979a7e504bb9 tests/usr.bin/indent/lex.0.stdout
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/indent/lex.0.stdout Sat Sep 25 12:20:44 2021 +0000
@@ -0,0 +1,21 @@
+/* $NetBSD: lex.0.stdout,v 1.1 2021/09/25 12:20:44 rillig Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Test lexing of tokens, such as keywords, identifiers, operators.
+ */
+
+/* GCC accepts this even with WARNS=6. */
+/* $ XXX: The indentation of the backslash is one short of a tab. */
+int           \
+               variable;
+
+int
+               no_backslash;
+
+struct 
long_tag_name_to_overflow_the_token_buffer_4567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
+
+struct 
long_tag_name_to_overflow_the_token_buffer_45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890;
+
+/* This is a syntax error; see lex_word. */
+int            identifier \n;



Home | Main Index | Thread Index | Old Index