tests/indent: add test for lexing of numbers

This commit is contained in:
rillig 2023-05-13 13:24:01 +00:00
parent af5234764a
commit 9db90c6e6b
3 changed files with 44 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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