Module Name:    src
Committed By:   rillig
Date:           Sat Oct 16 05:40:17 UTC 2021

Modified Files:
        src/tests/usr.bin/indent: opt_bbb.c opt_bc.c opt_bs.c opt_cdb.c
            opt_ce.c opt_cs.c opt_eei.c opt_ei.c opt_fbs.c opt_fc1.c opt_fcb.c
            opt_ip.c opt_lp.c opt_lpl.c opt_pcs.c opt_psl.c opt_sc.c opt_sob.c
            t_options.sh

Log Message:
tests/indent: remove duplicate data from options tests


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/opt_bbb.c \
    src/tests/usr.bin/indent/opt_bc.c src/tests/usr.bin/indent/opt_bs.c \
    src/tests/usr.bin/indent/opt_cdb.c src/tests/usr.bin/indent/opt_ce.c \
    src/tests/usr.bin/indent/opt_cs.c src/tests/usr.bin/indent/opt_eei.c \
    src/tests/usr.bin/indent/opt_ei.c src/tests/usr.bin/indent/opt_fbs.c \
    src/tests/usr.bin/indent/opt_fc1.c src/tests/usr.bin/indent/opt_fcb.c \
    src/tests/usr.bin/indent/opt_ip.c src/tests/usr.bin/indent/opt_lp.c \
    src/tests/usr.bin/indent/opt_lpl.c src/tests/usr.bin/indent/opt_pcs.c \
    src/tests/usr.bin/indent/opt_psl.c src/tests/usr.bin/indent/opt_sc.c \
    src/tests/usr.bin/indent/opt_sob.c src/tests/usr.bin/indent/t_options.sh

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_bbb.c
diff -u src/tests/usr.bin/indent/opt_bbb.c:1.1 src/tests/usr.bin/indent/opt_bbb.c:1.2
--- src/tests/usr.bin/indent/opt_bbb.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_bbb.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bbb.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_bbb.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -57,32 +57,6 @@ function_definition(void)
 }
 #indent end
 
-#indent input
-/*
- * 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)
-{
-}
-#indent end
-
 #indent run -nbbb
 /*
  * This is a block comment.
Index: src/tests/usr.bin/indent/opt_bc.c
diff -u src/tests/usr.bin/indent/opt_bc.c:1.1 src/tests/usr.bin/indent/opt_bc.c:1.2
--- src/tests/usr.bin/indent/opt_bc.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_bc.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bc.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_bc.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -13,11 +13,6 @@ int		a,
 void		function_declaration(int a, int b, int c);
 #indent end
 
-#indent input
-int a,b,c;
-void function_declaration(int a,int b,int c);
-#indent end
-
 #indent run -nbc
 int		a, b, c;
 void		function_declaration(int a, int b, int c);
Index: src/tests/usr.bin/indent/opt_bs.c
diff -u src/tests/usr.bin/indent/opt_bs.c:1.1 src/tests/usr.bin/indent/opt_bs.c:1.2
--- src/tests/usr.bin/indent/opt_bs.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_bs.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bs.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_bs.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -35,23 +35,6 @@ example(int i)
 }
 #indent end
 
-#indent input
-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));
-}
-#indent end
-
 #indent run -nbs
 void
 example(int i)
Index: src/tests/usr.bin/indent/opt_cdb.c
diff -u src/tests/usr.bin/indent/opt_cdb.c:1.1 src/tests/usr.bin/indent/opt_cdb.c:1.2
--- src/tests/usr.bin/indent/opt_cdb.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_cdb.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_cdb.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_cdb.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -81,51 +81,6 @@ example(void)
 }
 #indent end
 
-#indent input
-/* 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;
-}
-#indent end
-
 #indent run -ncdb
 /* A single-line comment. */
 
Index: src/tests/usr.bin/indent/opt_ce.c
diff -u src/tests/usr.bin/indent/opt_ce.c:1.1 src/tests/usr.bin/indent/opt_ce.c:1.2
--- src/tests/usr.bin/indent/opt_ce.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_ce.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_ce.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_ce.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -28,17 +28,6 @@ example(int n)
 }
 #indent end
 
-#indent input
-void
-example(int n)
-{
-	if (n > 99) { print("large"); }
-	else if (n > 9) { print("double-digit"); }
-	else if (n > 0) print("positive");
-	else { print("negative"); }
-}
-#indent end
-
 #indent run -nce
 void
 example(int n)
Index: src/tests/usr.bin/indent/opt_cs.c
diff -u src/tests/usr.bin/indent/opt_cs.c:1.1 src/tests/usr.bin/indent/opt_cs.c:1.2
--- src/tests/usr.bin/indent/opt_cs.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_cs.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_cs.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_cs.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -13,12 +13,6 @@ int		i1 = (int) 3.0;
 int		i3 = (int) 3.0;
 #indent end
 
-#indent input
-int		i0 = (int)3.0;
-int		i1 = (int) 3.0;
-int		i3 = (int)   3.0;
-#indent end
-
 #indent run -ncs
 int		i0 = (int)3.0;
 int		i1 = (int)3.0;
Index: src/tests/usr.bin/indent/opt_eei.c
diff -u src/tests/usr.bin/indent/opt_eei.c:1.1 src/tests/usr.bin/indent/opt_eei.c:1.2
--- src/tests/usr.bin/indent/opt_eei.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_eei.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_eei.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_eei.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -29,20 +29,6 @@ less(int a, int b)
 }
 #indent end
 
-#indent input
-bool
-less(int a, int b)
-{
-	if (a <
-	    b)
-		return true;
-	if (a
-	    <
-	    b)
-		return true;
-}
-#indent end
-
 #indent run -neei
 bool
 less(int a, int b)
Index: src/tests/usr.bin/indent/opt_ei.c
diff -u src/tests/usr.bin/indent/opt_ei.c:1.1 src/tests/usr.bin/indent/opt_ei.c:1.2
--- src/tests/usr.bin/indent/opt_ei.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_ei.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_ei.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_ei.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -33,22 +33,6 @@ example(int n)
 }
 #indent end
 
-#indent input
-void
-example(int n)
-{
-	if (n > 99) {
-		print("large");
-	} else if (n > 9) {
-		print("double-digit");
-	} else if (n > 0)
-		print("positive");
-	else {
-		print("negative");
-	}
-}
-#indent end
-
 #indent run -nei
 void
 example(int n)
Index: src/tests/usr.bin/indent/opt_fbs.c
diff -u src/tests/usr.bin/indent/opt_fbs.c:1.1 src/tests/usr.bin/indent/opt_fbs.c:1.2
--- src/tests/usr.bin/indent/opt_fbs.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_fbs.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_fbs.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_fbs.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -12,10 +12,6 @@ example(int n)
 }
 #indent end
 
-#indent input
-void example(int n) {}
-#indent end
-
 #indent run -nfbs
 void
 example(int n) {
Index: src/tests/usr.bin/indent/opt_fc1.c
diff -u src/tests/usr.bin/indent/opt_fc1.c:1.1 src/tests/usr.bin/indent/opt_fc1.c:1.2
--- src/tests/usr.bin/indent/opt_fc1.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_fc1.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_fc1.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_fc1.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -73,42 +73,6 @@
 				 * second comment */
 #indent end
 
-#indent input
-/*
- * A comment
- * in column 1.
- *
- *
- *
- */
-
-/* $ Neither indentation nor surrounding spaces. */
-/*narrow*/
-
-/* $ Indented by a single space, single spaces around the text. */
- /* space */
-
-/* $ Indented by a single tab, single tabs around the text. */
-	/*	tab	*/
-
-/* $ The space between these comments gets removed. */
-/* block1 */ /* block2 */
-
-/* $ Both comment texts get surrounded by spaces. */
-/*block1*//*block2*/
-
-/*
- * A multi-line comment that starts
- * in column 1.
- *//* followed by another multi-line comment
- * that starts in column 4.
- */
-
-/* comment */ int decl2; /* comment */
-/* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2; /* second comment */
-/* first comment */ int decl2; /* looooooooooooooooooooooooooooooooooooooooong second comment */
-#indent end
-
 #indent run -nfc1
 /*
  * A comment
Index: src/tests/usr.bin/indent/opt_fcb.c
diff -u src/tests/usr.bin/indent/opt_fcb.c:1.1 src/tests/usr.bin/indent/opt_fcb.c:1.2
--- src/tests/usr.bin/indent/opt_fcb.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_fcb.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_fcb.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_fcb.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -65,38 +65,6 @@ example(void)
 }
 #indent end
 
-#indent input
-/* FIXME: The options -fcb and -nfcb result in exactly the same output. */
-
-/* Not
- *
- * so carefully
- * formatted
- *      comment */
-
-/*-
- * car         mat         men
- *    efu   for   ted   com   t
- *       lly         box       .
- */
-
-void
-example(void)
-{
-	/* Not
-	 *
-	 * so carefully
-	 * formatted
-	 *      comment */
-
-	/*-
-	 * car         mat         men
-	 *    efu   for   ted   com   t
-	 *       lly         box       .
-	 */
-}
-#indent end
-
 #indent run -nfcb
 /* FIXME: The options -fcb and -nfcb result in exactly the same output. */
 
Index: src/tests/usr.bin/indent/opt_ip.c
diff -u src/tests/usr.bin/indent/opt_ip.c:1.1 src/tests/usr.bin/indent/opt_ip.c:1.2
--- src/tests/usr.bin/indent/opt_ip.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_ip.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_ip.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_ip.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -43,27 +43,6 @@ several_parameters_3(
 		     const char *cp);
 #indent end
 
-#indent input
-/* FIXME: The options -ip and -nip produce the same output. */
-
-int
-several_parameters_1(int a,
-int b,
-const char *cp);
-
-int
-several_parameters_2(
-int a,
-int b,
-const char *cp);
-
-int
-several_parameters_3(
-int a1, int a2,
-int b1, int b2,
-const char *cp);
-#indent end
-
 #indent run -nip
 /* FIXME: The options -ip and -nip produce the same output. */
 
Index: src/tests/usr.bin/indent/opt_lp.c
diff -u src/tests/usr.bin/indent/opt_lp.c:1.1 src/tests/usr.bin/indent/opt_lp.c:1.2
--- src/tests/usr.bin/indent/opt_lp.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_lp.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_lp.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_lp.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -29,20 +29,6 @@ example(void)
 }
 #indent end
 
-#indent input
-void
-example(void)
-{
-	p1 = first_procedure(second_procedure(p2, p3),
-	    third_procedure(p4, p5));
-
-	p1 = first_procedure(second_procedure(p2,
-	    p3),
-	    third_procedure(p4,
-	        p5));
-}
-#indent end
-
 #indent run -nlp
 void
 example(void)
Index: src/tests/usr.bin/indent/opt_lpl.c
diff -u src/tests/usr.bin/indent/opt_lpl.c:1.1 src/tests/usr.bin/indent/opt_lpl.c:1.2
--- src/tests/usr.bin/indent/opt_lpl.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_lpl.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_lpl.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_lpl.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -52,30 +52,6 @@ example(void)
 }
 #indent end
 
-#indent input
-void
-example(void)
-{
-	int sum1 = 1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21;
-	int sum2 = (1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21);
-
-	int sum3 = 1+2+3+4+5+
-		6+7+8+9+10+
-		11+12+13+14+15+
-		16+17+18+19+20+
-		21;
-	int sum4 = (1+2+3+4+5+
-		6+7+8+9+10+
-		11+12+13+14+15+
-		16+17+18+19+20+
-		21);
-
-	call_function(call_function(call_function(call_function(call_function(call_function())))));
-
-	call_function((call_function(call_function(call_function(call_function(call_function()))))));
-}
-#indent end
-
 #indent run -nlpl
 /* $ TODO: Add code that differs between -lpl and -nlpl. */
 void
Index: src/tests/usr.bin/indent/opt_pcs.c
diff -u src/tests/usr.bin/indent/opt_pcs.c:1.1 src/tests/usr.bin/indent/opt_pcs.c:1.2
--- src/tests/usr.bin/indent/opt_pcs.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_pcs.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_pcs.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_pcs.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -21,16 +21,6 @@ example(void)
 }
 #indent end
 
-#indent input
-void
-example(void)
-{
-	function_call();
-	function_call(1);
-	function_call(1,2,3);
-}
-#indent end
-
 #indent run -npcs
 void
 example(void)
Index: src/tests/usr.bin/indent/opt_psl.c
diff -u src/tests/usr.bin/indent/opt_psl.c:1.1 src/tests/usr.bin/indent/opt_psl.c:1.2
--- src/tests/usr.bin/indent/opt_psl.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_psl.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_psl.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_psl.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -16,12 +16,6 @@ function_definition(void)
 }
 #indent end
 
-#indent input
-void function_declaration(void);
-
-void function_definition(void) {}
-#indent end
-
 #indent run -npsl
 void		function_declaration(void);
 
Index: src/tests/usr.bin/indent/opt_sc.c
diff -u src/tests/usr.bin/indent/opt_sc.c:1.1 src/tests/usr.bin/indent/opt_sc.c:1.2
--- src/tests/usr.bin/indent/opt_sc.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_sc.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_sc.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_sc.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -31,21 +31,6 @@ asterisks
  */
 #indent end
 
-#indent input
-/* comment
-without
-asterisks
-*/
-
-/*
-** This comment style is used by Lua.
-*/
-
-/**
- * Javadoc, adopted by several other programming languages.
- */
-#indent end
-
 #indent run -nsc
 /*
 comment without asterisks
Index: src/tests/usr.bin/indent/opt_sob.c
diff -u src/tests/usr.bin/indent/opt_sob.c:1.1 src/tests/usr.bin/indent/opt_sob.c:1.2
--- src/tests/usr.bin/indent/opt_sob.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_sob.c	Sat Oct 16 05:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_sob.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_sob.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 #indent input
@@ -110,62 +110,6 @@ function_with_2_blank_lines(void)
 }
 #indent end
 
-#indent input
-void		function_declaration(void);
-
-
-int
-function_with_0_blank_lines(void)
-{
-	int		var;
-	var = value;
-	if (var > 0)
-		var--;
-	return var;
-}
-
-int
-function_with_1_blank_line(void)
-{
-
-	int		var;
-
-	var = value;
-
-	if (var > 0)
-/* $ The following line is "optional" but is not removed due to '-nsob'. */
-
-		var--;
-
-	return var;
-
-}
-
-
-int
-function_with_2_blank_lines(void)
-{
-
-
-	int		var;
-
-
-	var = value;
-
-
-	if (var > 0)
-/* $ The following 2 lines are "optional" and are not removed due to '-nsob'. */
-
-
-	    var--;
-
-
-	return var;
-
-
-}
-#indent end
-
 #indent run -nsob
 void		function_declaration(void);
 
Index: src/tests/usr.bin/indent/t_options.sh
diff -u src/tests/usr.bin/indent/t_options.sh:1.1 src/tests/usr.bin/indent/t_options.sh:1.2
--- src/tests/usr.bin/indent/t_options.sh:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/t_options.sh	Sat Oct 16 05:40:17 2021
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: t_options.sh,v 1.1 2021/10/16 03:20:13 rillig Exp $
+# $NetBSD: t_options.sh,v 1.2 2021/10/16 05:40:17 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -50,8 +50,11 @@ indent=$(atf_config_get usr.bin.indent.t
 check_awk='
 function die(msg)
 {
-	print msg > "/dev/stderr"
-	exit(1)
+	if (!died) {
+		died = 1
+		print msg > "/dev/stderr"
+		exit(1)
+	}
 }
 
 # Skip comments starting with dollar; they are used for marking bugs and
@@ -68,6 +71,8 @@ function die(msg)
 			die(FILENAME ":" unused ": input is not used")
 		mode = "input"
 		in_lines_len = 0
+		prev_input_all = input_all
+		input_all = ""
 		unused = NR
 	} else if ($2 == "run") {
 		mode = "run"
@@ -89,6 +94,8 @@ function die(msg)
 		close(cmd)
 		unused = 0
 	} else if ($2 == "end") {
+		if (mode == "input" && input_all == prev_input_all)
+			die(FILENAME ":" NR ": error: duplicate input")
 		mode = ""
 	} else {
 		die(FILENAME ":" NR ": error: invalid line \"" $0 "\"")
@@ -99,6 +106,7 @@ function die(msg)
 
 mode == "input" {
 	in_lines[++in_lines_len] = $0
+	input_all = input_all $0 "\n"
 }
 
 mode == "run" {

Reply via email to