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 lexing of character ...



details:   https://anonhg.NetBSD.org/src/rev/271b2b858094
branches:  trunk
changeset: 1023737:271b2b858094
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 25 09:46:29 2021 +0000

description:
tests/indent: test lexing of character constants and string literals

diffstat:

 distrib/sets/lists/tests/mi              |   8 +++++++-
 tests/usr.bin/indent/Makefile            |  10 ++++++++--
 tests/usr.bin/indent/lex_char.0          |  19 +++++++++++++++++++
 tests/usr.bin/indent/lex_char.0.pro      |   4 ++++
 tests/usr.bin/indent/lex_char.0.stdout   |  19 +++++++++++++++++++
 tests/usr.bin/indent/lex_string.0        |  26 ++++++++++++++++++++++++++
 tests/usr.bin/indent/lex_string.0.pro    |   4 ++++
 tests/usr.bin/indent/lex_string.0.stdout |  26 ++++++++++++++++++++++++++
 8 files changed, 113 insertions(+), 3 deletions(-)

diffs (175 lines):

diff -r dbc1ff8ea4d0 -r 271b2b858094 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sat Sep 25 09:22:39 2021 +0000
+++ b/distrib/sets/lists/tests/mi       Sat Sep 25 09:46:29 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1126 2021/09/19 15:51:28 thorpej Exp $
+# $NetBSD: mi,v 1.1127 2021/09/25 09:46:29 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4753,6 +4753,12 @@
 ./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_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
+./usr/tests/usr.bin/indent/lex_string.0                                        tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/indent/lex_string.0.pro                            tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/indent/lex_string.0.stdout                         tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/indent/lineno.0                                    tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/indent/lineno.0.pro                                        tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/indent/lineno.0.stdout                             tests-usr.bin-tests     compattestfile,atf
diff -r dbc1ff8ea4d0 -r 271b2b858094 tests/usr.bin/indent/Makefile
--- a/tests/usr.bin/indent/Makefile     Sat Sep 25 09:22:39 2021 +0000
+++ b/tests/usr.bin/indent/Makefile     Sat Sep 25 09:46:29 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.8 2021/03/12 00:13:06 rillig Exp $
+#      $NetBSD: Makefile,v 1.9 2021/09/25 09:46:29 rillig Exp $
 
 .include <bsd.own.mk>
 
@@ -30,6 +30,12 @@
 FILES+=                label.0
 FILES+=                label.0.stdout
 FILES+=                label.0.pro
+FILES+=                lex_char.0
+FILES+=                lex_char.0.pro
+FILES+=                lex_char.0.stdout
+FILES+=                lex_string.0
+FILES+=                lex_string.0.pro
+FILES+=                lex_string.0.stdout
 FILES+=                lineno.0
 FILES+=                lineno.0.pro
 FILES+=                lineno.0.stdout
@@ -406,7 +412,7 @@
                '' \
                '/*' \
                ' * TODO: Explain the purpose of the test.' \
-               '*/' \
+               ' */' \
                '' \
                '// TODO: Add some code that passes.' \
        > "$$test"; \
diff -r dbc1ff8ea4d0 -r 271b2b858094 tests/usr.bin/indent/lex_char.0
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/indent/lex_char.0   Sat Sep 25 09:46:29 2021 +0000
@@ -0,0 +1,19 @@
+/* $NetBSD: lex_char.0,v 1.1 2021/09/25 09:46:29 rillig Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Test lexing of character constants.
+ */
+
+int simple = 'x';
+int multi = 'xy';
+int empty = '';
+int null = '\0';
+int escape_hex = '\x3f';
+int escape_octal = '\040';
+int escape_a = '\a';
+int escape_b = '\b';
+int escape_f = '\f';
+int escape_n = '\n';
+int escape_t = '\t';
+int escape_v = '\v';
diff -r dbc1ff8ea4d0 -r 271b2b858094 tests/usr.bin/indent/lex_char.0.pro
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/indent/lex_char.0.pro       Sat Sep 25 09:46:29 2021 +0000
@@ -0,0 +1,4 @@
+/* $NetBSD: lex_char.0.pro,v 1.1 2021/09/25 09:46:29 rillig Exp $ */
+/* $FreeBSD$ */
+
+-di0
diff -r dbc1ff8ea4d0 -r 271b2b858094 tests/usr.bin/indent/lex_char.0.stdout
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/indent/lex_char.0.stdout    Sat Sep 25 09:46:29 2021 +0000
@@ -0,0 +1,19 @@
+/* $NetBSD: lex_char.0.stdout,v 1.1 2021/09/25 09:46:29 rillig Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Test lexing of character constants.
+ */
+
+int simple = 'x';
+int multi = 'xy';
+int empty = '';
+int null = '\0';
+int escape_hex = '\x3f';
+int escape_octal = '\040';
+int escape_a = '\a';
+int escape_b = '\b';
+int escape_f = '\f';
+int escape_n = '\n';
+int escape_t = '\t';
+int escape_v = '\v';
diff -r dbc1ff8ea4d0 -r 271b2b858094 tests/usr.bin/indent/lex_string.0
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/indent/lex_string.0 Sat Sep 25 09:46:29 2021 +0000
@@ -0,0 +1,26 @@
+/* $NetBSD: lex_string.0,v 1.1 2021/09/25 09:46:29 rillig Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Test lexing of string literals.
+ */
+
+char simple[] = "x";
+char multi[] = "xy";
+char empty[] = "";
+char null[] = "\0";
+char escape_hex[] = "\x3f";
+char escape_octal[] = "\040";
+char escape_a[] = "\a";
+char escape_b[] = "\b";
+char escape_f[] = "\f";
+char escape_n[] = "\n";
+char escape_t[] = "\t";
+char escape_v[] = "\v";
+
+char escape_newline[] = "\
+";
+
+/* Concatenated string literals are separated with a single space. */
+char concat[] = "line 1\n"
+"line2"                "has"   "several""words\n";
diff -r dbc1ff8ea4d0 -r 271b2b858094 tests/usr.bin/indent/lex_string.0.pro
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/indent/lex_string.0.pro     Sat Sep 25 09:46:29 2021 +0000
@@ -0,0 +1,4 @@
+/* $NetBSD: lex_string.0.pro,v 1.1 2021/09/25 09:46:29 rillig Exp $ */
+/* $FreeBSD$ */
+
+-di0
diff -r dbc1ff8ea4d0 -r 271b2b858094 tests/usr.bin/indent/lex_string.0.stdout
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/indent/lex_string.0.stdout  Sat Sep 25 09:46:29 2021 +0000
@@ -0,0 +1,26 @@
+/* $NetBSD: lex_string.0.stdout,v 1.1 2021/09/25 09:46:29 rillig Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Test lexing of string literals.
+ */
+
+char simple[] = "x";
+char multi[] = "xy";
+char empty[] = "";
+char null[] = "\0";
+char escape_hex[] = "\x3f";
+char escape_octal[] = "\040";
+char escape_a[] = "\a";
+char escape_b[] = "\b";
+char escape_f[] = "\f";
+char escape_n[] = "\n";
+char escape_t[] = "\t";
+char escape_v[] = "\v";
+
+char escape_newline[] = "\
+";
+
+/* Concatenated string literals are separated with a single space. */
+char concat[] = "line 1\n"
+"line2" "has" "several" "words\n";



Home | Main Index | Thread Index | Old Index