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: add test for lexing of nu...
details: https://anonhg.NetBSD.org/src/rev/1ff6f3761b2f
branches: trunk
changeset: 374821:1ff6f3761b2f
user: rillig <rillig%NetBSD.org@localhost>
date: Sat May 13 13:24:01 2023 +0000
description:
tests/indent: add test for lexing of numbers
diffstat:
distrib/sets/lists/tests/mi | 3 +-
tests/usr.bin/indent/Makefile | 3 +-
tests/usr.bin/indent/lex_number.c | 40 +++++++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 2 deletions(-)
diffs (78 lines):
diff -r 7b5b10ff9557 -r 1ff6f3761b2f distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Sat May 13 13:21:35 2023 +0000
+++ b/distrib/sets/lists/tests/mi Sat May 13 13:24:01 2023 +0000
@@ -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
diff -r 7b5b10ff9557 -r 1ff6f3761b2f tests/usr.bin/indent/Makefile
--- a/tests/usr.bin/indent/Makefile Sat May 13 13:21:35 2023 +0000
+++ b/tests/usr.bin/indent/Makefile Sat May 13 13:24:01 2023 +0000
@@ -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
diff -r 7b5b10ff9557 -r 1ff6f3761b2f tests/usr.bin/indent/lex_number.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/indent/lex_number.c Sat May 13 13:24:01 2023 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index