Module Name: src Committed By: rillig Date: Sat Mar 6 23:09:17 UTC 2021
Modified Files: src/tests/usr.bin/indent: opt-nbacc.0 opt-nbacc.0.stdout opt-nbad.0 opt-nbad.0.stdout opt-nbadp.0 opt-nbadp.0.stdout opt-nbap.0 opt-nbap.0.stdout opt-nbbb.0 opt-nbbb.0.stdout opt-nbc.0 opt-nbc.0.stdout opt-nbs.0 opt-nbs.0.stdout opt-ncdb.0 opt-ncdb.0.stdout opt-ncs.0 opt-ncs.0.stdout opt-ndj.0 opt-ndj.0.stdout opt-neei.0 opt-neei.0.stdout Log Message: tests/indent: add tests for negative options Since most of these options are of the form "don't do anything", the input and output of these tests is very similar. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/opt-nbacc.0 \ src/tests/usr.bin/indent/opt-nbacc.0.stdout \ src/tests/usr.bin/indent/opt-nbad.0 \ src/tests/usr.bin/indent/opt-nbad.0.stdout \ src/tests/usr.bin/indent/opt-nbadp.0 \ src/tests/usr.bin/indent/opt-nbadp.0.stdout \ src/tests/usr.bin/indent/opt-nbap.0 \ src/tests/usr.bin/indent/opt-nbap.0.stdout \ src/tests/usr.bin/indent/opt-nbbb.0 \ src/tests/usr.bin/indent/opt-nbbb.0.stdout \ src/tests/usr.bin/indent/opt-nbc.0 \ src/tests/usr.bin/indent/opt-nbc.0.stdout \ src/tests/usr.bin/indent/opt-nbs.0 \ src/tests/usr.bin/indent/opt-nbs.0.stdout \ src/tests/usr.bin/indent/opt-ncdb.0 \ src/tests/usr.bin/indent/opt-ncdb.0.stdout \ src/tests/usr.bin/indent/opt-ncs.0 \ src/tests/usr.bin/indent/opt-ncs.0.stdout \ src/tests/usr.bin/indent/opt-ndj.0 \ src/tests/usr.bin/indent/opt-ndj.0.stdout \ src/tests/usr.bin/indent/opt-neei.0 \ src/tests/usr.bin/indent/opt-neei.0.stdout Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/indent/opt-nbacc.0 diff -u src/tests/usr.bin/indent/opt-nbacc.0:1.1 src/tests/usr.bin/indent/opt-nbacc.0:1.2 --- src/tests/usr.bin/indent/opt-nbacc.0:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbacc.0 Sat Mar 6 23:09:17 2021 @@ -1,4 +1,19 @@ -/* $NetBSD: opt-nbacc.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbacc.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +int a; +#if 0 +int b; +#endif +int c; + + +int space_a; + +#if 0 + +int space_b; + +#endif + +int space_c; Index: src/tests/usr.bin/indent/opt-nbacc.0.stdout diff -u src/tests/usr.bin/indent/opt-nbacc.0.stdout:1.1 src/tests/usr.bin/indent/opt-nbacc.0.stdout:1.2 --- src/tests/usr.bin/indent/opt-nbacc.0.stdout:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbacc.0.stdout Sat Mar 6 23:09:17 2021 @@ -1,4 +1,19 @@ -/* $NetBSD: opt-nbacc.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbacc.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +int a; +#if 0 +int b; +#endif +int c; + + +int space_a; + +#if 0 + +int space_b; + +#endif + +int space_c; Index: src/tests/usr.bin/indent/opt-nbad.0 diff -u src/tests/usr.bin/indent/opt-nbad.0:1.1 src/tests/usr.bin/indent/opt-nbad.0:1.2 --- src/tests/usr.bin/indent/opt-nbad.0:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbad.0 Sat Mar 6 23:09:17 2021 @@ -1,4 +1,13 @@ -/* $NetBSD: opt-nbad.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbad.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +int global_variable; +void function_declaration(void); +#if 0 +#endif +void function_definition(void) { + int local_variable; + function_call(); + int local_variable_after_statement; + function_call(); +} Index: src/tests/usr.bin/indent/opt-nbad.0.stdout diff -u src/tests/usr.bin/indent/opt-nbad.0.stdout:1.1 src/tests/usr.bin/indent/opt-nbad.0.stdout:1.2 --- src/tests/usr.bin/indent/opt-nbad.0.stdout:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbad.0.stdout Sat Mar 6 23:09:17 2021 @@ -1,4 +1,15 @@ -/* $NetBSD: opt-nbad.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbad.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +int global_variable; +void function_declaration(void); +#if 0 +#endif +void +function_definition(void) +{ + int local_variable; + function_call(); + int local_variable_after_statement; + function_call(); +} Index: src/tests/usr.bin/indent/opt-nbadp.0 diff -u src/tests/usr.bin/indent/opt-nbadp.0:1.1 src/tests/usr.bin/indent/opt-nbadp.0:1.2 --- src/tests/usr.bin/indent/opt-nbadp.0:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbadp.0 Sat Mar 6 23:09:17 2021 @@ -1,4 +1,33 @@ -/* $NetBSD: opt-nbadp.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbadp.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +static void +no_declarations(void) +{ + action(); +} + +static void +declarations_without_blank_line(void) +{ + int local_variable; + action(); +} + +static void +declaration_with_blank_line(void) +{ + int local_variable; + + action(); +} + +static void +declaration_with_several_blank_lines(void) +{ + int local_variable; + + + + action(); +} Index: src/tests/usr.bin/indent/opt-nbadp.0.stdout diff -u src/tests/usr.bin/indent/opt-nbadp.0.stdout:1.1 src/tests/usr.bin/indent/opt-nbadp.0.stdout:1.2 --- src/tests/usr.bin/indent/opt-nbadp.0.stdout:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbadp.0.stdout Sat Mar 6 23:09:17 2021 @@ -1,4 +1,33 @@ -/* $NetBSD: opt-nbadp.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbadp.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +static void +no_declarations(void) +{ + action(); +} + +static void +declarations_without_blank_line(void) +{ + int local_variable; + action(); +} + +static void +declaration_with_blank_line(void) +{ + int local_variable; + + action(); +} + +static void +declaration_with_several_blank_lines(void) +{ + int local_variable; + + + + action(); +} Index: src/tests/usr.bin/indent/opt-nbap.0 diff -u src/tests/usr.bin/indent/opt-nbap.0:1.1 src/tests/usr.bin/indent/opt-nbap.0:1.2 --- src/tests/usr.bin/indent/opt-nbap.0:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbap.0 Sat Mar 6 23:09:17 2021 @@ -1,4 +1,21 @@ -/* $NetBSD: opt-nbap.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbap.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +static void one_liner(void) {} +static void several_lines(void) { + action(); +} +int main(void){} +int global_variable; + +void already_has_blank_line_below(void) +{ +} + +void has_several_blank_lines_below(void) +{ +} + + + +int the_end; Index: src/tests/usr.bin/indent/opt-nbap.0.stdout diff -u src/tests/usr.bin/indent/opt-nbap.0.stdout:1.1 src/tests/usr.bin/indent/opt-nbap.0.stdout:1.2 --- src/tests/usr.bin/indent/opt-nbap.0.stdout:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbap.0.stdout Sat Mar 6 23:09:17 2021 @@ -1,4 +1,31 @@ -/* $NetBSD: opt-nbap.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbap.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +static void +one_liner(void) +{ +} +static void +several_lines(void) +{ + action(); +} +int +main(void) +{ +} +int global_variable; + +void +already_has_blank_line_below(void) +{ +} + +void +has_several_blank_lines_below(void) +{ +} + + + +int the_end; Index: src/tests/usr.bin/indent/opt-nbbb.0 diff -u src/tests/usr.bin/indent/opt-nbbb.0:1.1 src/tests/usr.bin/indent/opt-nbbb.0:1.2 --- src/tests/usr.bin/indent/opt-nbbb.0:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbbb.0 Sat Mar 6 23:09:17 2021 @@ -1,4 +1,26 @@ -/* $NetBSD: opt-nbbb.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbbb.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +/* + * This is a block comment. + */ +/* This is not a block comment since it is single-line. */ +/* + * This is a second block comment. + */ +/* This is not a block comment. */ +/* + * Documentation of global_variable. + */ +int global_variable; +/* + * Documentation of function_declaration. + */ +void function_declaration(void); +/* + * Documentation of function_definition. + */ +void +function_definition(void) +{ +} Index: src/tests/usr.bin/indent/opt-nbbb.0.stdout diff -u src/tests/usr.bin/indent/opt-nbbb.0.stdout:1.1 src/tests/usr.bin/indent/opt-nbbb.0.stdout:1.2 --- src/tests/usr.bin/indent/opt-nbbb.0.stdout:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbbb.0.stdout Sat Mar 6 23:09:17 2021 @@ -1,4 +1,26 @@ -/* $NetBSD: opt-nbbb.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbbb.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +/* + * This is a block comment. + */ +/* This is not a block comment since it is single-line. */ +/* + * This is a second block comment. + */ +/* This is not a block comment. */ +/* + * Documentation of global_variable. + */ +int global_variable; +/* + * Documentation of function_declaration. + */ +void function_declaration(void); +/* + * Documentation of function_definition. + */ +void +function_definition(void) +{ +} Index: src/tests/usr.bin/indent/opt-nbc.0 diff -u src/tests/usr.bin/indent/opt-nbc.0:1.1 src/tests/usr.bin/indent/opt-nbc.0:1.2 --- src/tests/usr.bin/indent/opt-nbc.0:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbc.0 Sat Mar 6 23:09:17 2021 @@ -1,4 +1,5 @@ -/* $NetBSD: opt-nbc.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbc.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +int a,b,c; +void function_declaration(int a,int b,int c); Index: src/tests/usr.bin/indent/opt-nbc.0.stdout diff -u src/tests/usr.bin/indent/opt-nbc.0.stdout:1.1 src/tests/usr.bin/indent/opt-nbc.0.stdout:1.2 --- src/tests/usr.bin/indent/opt-nbc.0.stdout:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbc.0.stdout Sat Mar 6 23:09:17 2021 @@ -1,4 +1,5 @@ -/* $NetBSD: opt-nbc.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbc.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +int a, b, c; +void function_declaration(int a, int b, int c); Index: src/tests/usr.bin/indent/opt-nbs.0 diff -u src/tests/usr.bin/indent/opt-nbs.0:1.1 src/tests/usr.bin/indent/opt-nbs.0:1.2 --- src/tests/usr.bin/indent/opt-nbs.0:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbs.0 Sat Mar 6 23:09:17 2021 @@ -1,4 +1,17 @@ -/* $NetBSD: opt-nbs.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbs.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +void +example(int i) +{ + print(sizeof(i)); + print(sizeof(int)); + + print(sizeof i); + print(sizeof (i)); + print(sizeof (int)); + + print(sizeof i); + print(sizeof (i)); + print(sizeof (int)); +} Index: src/tests/usr.bin/indent/opt-nbs.0.stdout diff -u src/tests/usr.bin/indent/opt-nbs.0.stdout:1.1 src/tests/usr.bin/indent/opt-nbs.0.stdout:1.2 --- src/tests/usr.bin/indent/opt-nbs.0.stdout:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-nbs.0.stdout Sat Mar 6 23:09:17 2021 @@ -1,4 +1,17 @@ -/* $NetBSD: opt-nbs.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-nbs.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +void +example(int i) +{ + print(sizeof(i)); + print(sizeof(int)); + + print(sizeof i); + print(sizeof(i)); + print(sizeof(int)); + + print(sizeof i); + print(sizeof(i)); + print(sizeof(int)); +} Index: src/tests/usr.bin/indent/opt-ncdb.0 diff -u src/tests/usr.bin/indent/opt-ncdb.0:1.1 src/tests/usr.bin/indent/opt-ncdb.0:1.2 --- src/tests/usr.bin/indent/opt-ncdb.0:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-ncdb.0 Sat Mar 6 23:09:17 2021 @@ -1,4 +1,45 @@ -/* $NetBSD: opt-ncdb.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-ncdb.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +/* A single-line comment. */ + +/* A + * multi-line + * comment. */ + +/* + * A + * multi-line + * comment. + */ + +int ga; /* A single-line comment. */ + +int gb; /* A + * multi-line + * comment. */ + +int gc; /* + * A + * multi-line + * comment. + */ + +void +example(void) +{ + /* A single-line comment. */ + int la; + + /* A + * multi-line + * comment. */ + int lb; + + /* + * A + * multi-line + * comment. + */ + int lc; +} Index: src/tests/usr.bin/indent/opt-ncdb.0.stdout diff -u src/tests/usr.bin/indent/opt-ncdb.0.stdout:1.1 src/tests/usr.bin/indent/opt-ncdb.0.stdout:1.2 --- src/tests/usr.bin/indent/opt-ncdb.0.stdout:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-ncdb.0.stdout Sat Mar 6 23:09:17 2021 @@ -1,4 +1,27 @@ -/* $NetBSD: opt-ncdb.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-ncdb.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +/* A single-line comment. */ + +/* A multi-line comment. */ + +/* A multi-line comment. */ + +int ga; /* A single-line comment. */ + +int gb; /* A multi-line comment. */ + +int gc; /* A multi-line comment. */ + +void +example(void) +{ + /* A single-line comment. */ + int la; + + /* A multi-line comment. */ + int lb; + + /* A multi-line comment. */ + int lc; +} Index: src/tests/usr.bin/indent/opt-ncs.0 diff -u src/tests/usr.bin/indent/opt-ncs.0:1.1 src/tests/usr.bin/indent/opt-ncs.0:1.2 --- src/tests/usr.bin/indent/opt-ncs.0:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-ncs.0 Sat Mar 6 23:09:17 2021 @@ -1,4 +1,6 @@ -/* $NetBSD: opt-ncs.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-ncs.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +int i0 = (int)3.0; +int i1 = (int) 3.0; +int i3 = (int) 3.0; Index: src/tests/usr.bin/indent/opt-ncs.0.stdout diff -u src/tests/usr.bin/indent/opt-ncs.0.stdout:1.1 src/tests/usr.bin/indent/opt-ncs.0.stdout:1.2 --- src/tests/usr.bin/indent/opt-ncs.0.stdout:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-ncs.0.stdout Sat Mar 6 23:09:17 2021 @@ -1,4 +1,6 @@ -/* $NetBSD: opt-ncs.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-ncs.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +int i0 = (int)3.0; +int i1 = (int)3.0; +int i3 = (int)3.0; Index: src/tests/usr.bin/indent/opt-ndj.0 diff -u src/tests/usr.bin/indent/opt-ndj.0:1.1 src/tests/usr.bin/indent/opt-ndj.0:1.2 --- src/tests/usr.bin/indent/opt-ndj.0:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-ndj.0 Sat Mar 6 23:09:17 2021 @@ -1,4 +1,11 @@ -/* $NetBSD: opt-ndj.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-ndj.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +/* FIXME: The options -dj and -ndj produce the same output. */ + +int i; +int *ip; +const char *ccp; +const void *****vppppp; +const void ******vpppppp; +const void ********vpppppppp; Index: src/tests/usr.bin/indent/opt-ndj.0.stdout diff -u src/tests/usr.bin/indent/opt-ndj.0.stdout:1.1 src/tests/usr.bin/indent/opt-ndj.0.stdout:1.2 --- src/tests/usr.bin/indent/opt-ndj.0.stdout:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-ndj.0.stdout Sat Mar 6 23:09:17 2021 @@ -1,4 +1,11 @@ -/* $NetBSD: opt-ndj.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-ndj.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +/* FIXME: The options -dj and -ndj produce the same output. */ + +int i; +int *ip; +const char *ccp; +const void *****vppppp; +const void ******vpppppp; +const void ********vpppppppp; Index: src/tests/usr.bin/indent/opt-neei.0 diff -u src/tests/usr.bin/indent/opt-neei.0:1.1 src/tests/usr.bin/indent/opt-neei.0:1.2 --- src/tests/usr.bin/indent/opt-neei.0:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-neei.0 Sat Mar 6 23:09:17 2021 @@ -1,4 +1,14 @@ -/* $NetBSD: opt-neei.0,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-neei.0,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +bool +less(int a, int b) +{ + if (a < + b) + return true; + if (a + < + b) + return true; +} Index: src/tests/usr.bin/indent/opt-neei.0.stdout diff -u src/tests/usr.bin/indent/opt-neei.0.stdout:1.1 src/tests/usr.bin/indent/opt-neei.0.stdout:1.2 --- src/tests/usr.bin/indent/opt-neei.0.stdout:1.1 Sat Mar 6 17:56:34 2021 +++ src/tests/usr.bin/indent/opt-neei.0.stdout Sat Mar 6 23:09:17 2021 @@ -1,4 +1,14 @@ -/* $NetBSD: opt-neei.0.stdout,v 1.1 2021/03/06 17:56:34 rillig Exp $ */ +/* $NetBSD: opt-neei.0.stdout,v 1.2 2021/03/06 23:09:17 rillig Exp $ */ /* $FreeBSD$ */ -/* TODO: implement the test */ +bool +less(int a, int b) +{ + if (a < + b) + return true; + if (a + < + b) + return true; +}