Module Name: src
Committed By: rillig
Date: Sat May 13 13:24:01 UTC 2023
Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/indent: Makefile
Added Files:
src/tests/usr.bin/indent: lex_number.c
Log Message:
tests/indent: add test for lexing of numbers
To generate a diff of this commit:
cvs rdiff -u -r1.1262 -r1.1263 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.45 -r1.46 src/tests/usr.bin/indent/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/lex_number.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1262 src/distrib/sets/lists/tests/mi:1.1263
--- src/distrib/sets/lists/tests/mi:1.1262 Sat May 13 13:21:35 2023
+++ src/distrib/sets/lists/tests/mi Sat May 13 13:24:01 2023
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1262 2023/05/13 13:21:35 rillig Exp $
+# $NetBSD: mi,v 1.1263 2023/05/13 13:24:01 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -4923,6 +4923,7 @@
./usr/tests/usr.bin/indent/lex_char.0.stdout tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/lex_char.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/lex_ident.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/lex_number.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/lex_string.0 tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/lex_string.0.pro tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/lex_string.0.stdout tests-obsolete obsolete,atf
Index: src/tests/usr.bin/indent/Makefile
diff -u src/tests/usr.bin/indent/Makefile:1.45 src/tests/usr.bin/indent/Makefile:1.46
--- src/tests/usr.bin/indent/Makefile:1.45 Sun Apr 24 10:36:37 2022
+++ src/tests/usr.bin/indent/Makefile Sat May 13 13:24:01 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.45 2022/04/24 10:36:37 rillig Exp $
+# $NetBSD: Makefile,v 1.46 2023/05/13 13:24:01 rillig Exp $
.include <bsd.own.mk>
@@ -18,6 +18,7 @@ FILES+= indent_off_on.c
FILES+= label.c
FILES+= lex_char.c
FILES+= lex_ident.c
+FILES+= lex_number.c
FILES+= lex_string.c
FILES+= lsym_binary_op.c
FILES+= lsym_case_label.c
Added files:
Index: src/tests/usr.bin/indent/lex_number.c
diff -u /dev/null src/tests/usr.bin/indent/lex_number.c:1.1
--- /dev/null Sat May 13 13:24:01 2023
+++ src/tests/usr.bin/indent/lex_number.c Sat May 13 13:24:01 2023
@@ -0,0 +1,40 @@
+/* $NetBSD: lex_number.c,v 1.1 2023/05/13 13:24:01 rillig Exp $ */
+
+/*
+ * Test lexing of numbers.
+ */
+
+//indent input
+int integers[] = {
+ 0, // octal zero
+ 1000, // decimal
+ 10000000000000000000000000000000000000000000, // big decimal
+ 100000000000000000000000000000000000000000LU, // suffix
+ 0x12345678, // hex
+};
+
+double floats[] = {
+ 0.0,
+ 0.0f,
+ 0.0F,
+ 1.0e-1000,
+ 1.0e+1000,
+};
+//indent end
+
+//indent run-equals-input -di0
+
+
+//indent input
+int wrapped = 0\
+x\
+12\
+3456\
+78;
+//indent end
+
+/* FIXME: properly unwrap numbers */
+//indent run -di0
+int wrapped = 0 \
+x12345678;
+//indent end