tests/indent: migrate tests for parentheses, struct, #if, wide char

This commit is contained in:
rillig 2021-10-22 19:46:41 +00:00
parent 8c1e5e0299
commit e1e8104f85
15 changed files with 94 additions and 167 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.1149 2021/10/22 19:27:53 rillig Exp $
# $NetBSD: mi,v 1.1150 2021/10/22 19:46:41 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -5023,9 +5023,9 @@
./usr/tests/usr.bin/indent/opt_sob.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/opt_ut.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/opt_v.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/parens.0 tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/parens.0.pro tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/parens.0.stdout tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/parens.0 tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/parens.0.pro tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/parens.0.stdout tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/pcs.0 tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/pcs.0.pro tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/pcs.0.stdout tests-obsolete obsolete,atf
@ -5033,11 +5033,11 @@
./usr/tests/usr.bin/indent/ps_ind_level.0.pro tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/ps_ind_level.0.stdout tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/ps_ind_level.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/struct.0 tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/struct.0.stdout tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/surplusbad.0 tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/surplusbad.0.pro tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/surplusbad.0.stdout tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/struct.0 tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/struct.0.stdout tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/surplusbad.0 tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/surplusbad.0.pro tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/surplusbad.0.stdout tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/t_errors tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/t_indent tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/t_misc tests-usr.bin-tests compattestfile,atf
@ -5199,8 +5199,8 @@
./usr/tests/usr.bin/indent/types_from_file.0.list tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/types_from_file.0.pro tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/types_from_file.0.stdout tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/wchar.0 tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/wchar.0.stdout tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/wchar.0 tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/wchar.0.stdout tests-obsolete obsolete,atf
./usr/tests/usr.bin/infocmp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/infocmp/Atffile tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/infocmp/Kyuafile tests-usr.bin-tests compattestfile,atf,kyua

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.25 2021/10/22 19:27:53 rillig Exp $
# $NetBSD: Makefile,v 1.26 2021/10/22 19:46:41 rillig Exp $
.include <bsd.own.mk>
@ -116,15 +116,7 @@ FILES+= opt_sc.c
FILES+= opt_sob.c
FILES+= opt_ut.c
FILES+= opt_v.c
FILES+= parens.0
FILES+= parens.0.stdout
FILES+= parens.0.pro
FILES+= ps_ind_level.c
FILES+= struct.0
FILES+= struct.0.stdout
FILES+= surplusbad.0
FILES+= surplusbad.0.stdout
FILES+= surplusbad.0.pro
FILES+= t_options.awk
FILES+= token_binary_op.c
FILES+= token_case_label.c
@ -168,8 +160,6 @@ FILES+= types_from_file.0
FILES+= types_from_file.0.stdout
FILES+= types_from_file.0.list
FILES+= types_from_file.0.pro
FILES+= wchar.0
FILES+= wchar.0.stdout
add-test: .PHONY
@set -eu; \

View File

@ -1,4 +1,4 @@
/* $NetBSD: opt_bad.c,v 1.3 2021/10/18 07:11:31 rillig Exp $ */
/* $NetBSD: opt_bad.c,v 1.4 2021/10/22 19:46:41 rillig Exp $ */
/* $FreeBSD$ */
/*
@ -30,6 +30,29 @@ void function_declaration(void);
#indent run-equals-prev-output -nbad
/* See FreeBSD r303599. */
#indent input
#if defined(__i386__)
int a;
#elif defined(__amd64__)
int b;
#else
#error "Port me"
#endif
#indent end
#indent run -bad
#if defined(__i386__)
int a;
#elif defined(__amd64__)
int b;
#else
#error "Port me"
#endif
#indent end
/* Test local declarations. */
#indent input
void function_definition(void) {

View File

@ -1,28 +0,0 @@
/* $NetBSD: parens.0,v 1.2 2021/03/06 19:51:24 rillig Exp $ */
/* $FreeBSD: head/usr.bin/indent/tests/parens.0 334583 2018-06-03 19:05:20Z pstef $ */
typedef void (*xxxxxxxxxxx) (int,
char);
typedef char (*xxxxxxxxxxxxxxxxxxxxxxxxxxxx) (int *,
unsigned *,
char,
float *);
void
test(void)
{
char chars[secondf(firstf(B),
*here)];
float xxx = yyyyyyyyyyyyyy(zzzzzzzzzzzzz(p1,
(p2),
p3));
if (1) {
char *xxx = firstf(secondf2(p1,
p2));
}
rb->allocfunc(1);
rb2.allocfunc(7);
}

View File

@ -1,3 +0,0 @@
/* $NetBSD: parens.0.pro,v 1.1 2019/04/04 15:27:35 kamil Exp $ */
/* $FreeBSD: head/usr.bin/indent/tests/parens.0.pro 334583 2018-06-03 19:05:20Z pstef $ */
-ts4 -i4 -di12 -Tallocfunc

View File

@ -1,28 +0,0 @@
/* $NetBSD: parens.0.stdout,v 1.2 2021/09/30 21:48:12 rillig Exp $ */
/* $FreeBSD: head/usr.bin/indent/tests/parens.0.stdout 334583 2018-06-03 19:05:20Z pstef $ */
typedef void (*xxxxxxxxxxx)(int,
char);
typedef char (*xxxxxxxxxxxxxxxxxxxxxxxxxxxx)(int *,
unsigned *,
char,
float *);
void
test(void)
{
char chars[secondf(firstf(B),
*here)];
float xxx = yyyyyyyyyyyyyy(zzzzzzzzzzzzz(p1,
(p2),
p3));
if (1) {
char *xxx = firstf(secondf2(p1,
p2));
}
rb->allocfunc(1);
rb2.allocfunc(7);
}

View File

@ -1,22 +0,0 @@
/* $NetBSD: struct.0,v 1.1 2019/04/04 15:27:35 kamil Exp $ */
/* $FreeBSD: head/usr.bin/indent/tests/struct.0 334564 2018-06-03 16:21:15Z pstef $ */
int f(struct x *a);
/* See r303485 */
void
t(void)
{
static const struct {
int a;
int b;
} c[] = {
{ D, E },
{ F, G }
};
}
void u(struct x a) {
int b;
struct y c = (struct y *)&a;
}

View File

@ -1,24 +0,0 @@
/* $NetBSD: struct.0.stdout,v 1.1 2019/04/04 15:27:35 kamil Exp $ */
/* $FreeBSD: head/usr.bin/indent/tests/struct.0.stdout 334564 2018-06-03 16:21:15Z pstef $ */
int f(struct x *a);
/* See r303485 */
void
t(void)
{
static const struct {
int a;
int b;
} c[] = {
{D, E},
{F, G}
};
}
void
u(struct x a)
{
int b;
struct y c = (struct y *)&a;
}

View File

@ -1,10 +0,0 @@
/* $NetBSD: surplusbad.0,v 1.1 2019/04/04 15:27:35 kamil Exp $ */
/* $FreeBSD: head/usr.bin/indent/tests/surplusbad.0 313544 2017-02-10 09:31:39Z pstef $ */
/* See r303599 */
#if defined(__i386__)
int a;
#elif defined(__amd64__)
int b;
#else
#error "Port me"
#endif

View File

@ -1,3 +0,0 @@
/* $NetBSD: surplusbad.0.pro,v 1.1 2019/04/04 15:27:35 kamil Exp $ */
/* $FreeBSD: head/usr.bin/indent/tests/surplusbad.0.pro 314613 2017-03-03 20:15:22Z ngie $ */
-bad

View File

@ -1,10 +0,0 @@
/* $NetBSD: surplusbad.0.stdout,v 1.1 2019/04/04 15:27:35 kamil Exp $ */
/* $FreeBSD: head/usr.bin/indent/tests/surplusbad.0.stdout 313544 2017-02-10 09:31:39Z pstef $ */
/* See r303599 */
#if defined(__i386__)
int a;
#elif defined(__amd64__)
int b;
#else
#error "Port me"
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: token_keyword_struct_union_enum.c,v 1.1 2021/10/18 22:30:34 rillig Exp $ */
/* $NetBSD: token_keyword_struct_union_enum.c,v 1.2 2021/10/22 19:46:41 rillig Exp $ */
/* $FreeBSD$ */
/*
@ -21,3 +21,50 @@ union variant {
#indent end
#indent run-equals-input
/* See FreeBSD r303485. */
/* $FreeBSD: head/usr.bin/indent/tests/struct.0 334564 2018-06-03 16:21:15Z pstef $ */
#indent input
int f(struct x *a);
void
t(void)
{
static const struct {
int a;
int b;
} c[] = {
{ D, E },
{ F, G }
};
}
void u(struct x a) {
int b;
struct y c = (struct y *)&a;
}
#indent end
#indent run
int f(struct x *a);
void
t(void)
{
static const struct {
int a;
int b;
} c[] = {
{D, E},
{F, G}
};
}
void
u(struct x a)
{
int b;
struct y c = (struct y *)&a;
}
#indent end

View File

@ -1,8 +1,10 @@
/* $NetBSD: token_string_prefix.c,v 1.1 2021/10/18 22:30:34 rillig Exp $ */
/* $NetBSD: token_string_prefix.c,v 1.2 2021/10/22 19:46:41 rillig Exp $ */
/* $FreeBSD$ */
/*
* Tests for strings of wide characters, which are prefixed with 'L'.
*
* See FreeBSD r309220.
*/
#indent input
@ -16,3 +18,10 @@ wchar_t wide_string[] = L"wide string";
#indent run-equals-input -di0
#indent run-equals-input -di0 -l25
#indent run-equals-input -di0 -l1
#indent input
wchar_t wide_char[] = L'w';
#indent end
#indent run-equals-input -di0

View File

@ -1,7 +0,0 @@
/* $NetBSD: wchar.0,v 1.1 2019/04/04 15:27:35 kamil Exp $ */
/* $FreeBSD: head/usr.bin/indent/tests/wchar.0 313544 2017-02-10 09:31:39Z pstef $ */
/* See r309220 */
#include <wchar.h>
wchar_t *x = L"test";
wchar_t y = L't';

View File

@ -1,7 +0,0 @@
/* $NetBSD: wchar.0.stdout,v 1.1 2019/04/04 15:27:35 kamil Exp $ */
/* $FreeBSD: head/usr.bin/indent/tests/wchar.0.stdout 313544 2017-02-10 09:31:39Z pstef $ */
/* See r309220 */
#include <wchar.h>
wchar_t *x = L"test";
wchar_t y = L't';