Module Name:    src
Committed By:   rillig
Date:           Sat Sep 25 13:26:07 UTC 2021

Modified Files:
        src/tests/usr.bin/indent: token-while_expr.0 token-while_expr.0.stdout

Log Message:
tests/indent: test formatting of while and do-while loops


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/token-while_expr.0 \
    src/tests/usr.bin/indent/token-while_expr.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/token-while_expr.0
diff -u src/tests/usr.bin/indent/token-while_expr.0:1.1 src/tests/usr.bin/indent/token-while_expr.0:1.2
--- src/tests/usr.bin/indent/token-while_expr.0:1.1	Fri Mar 12 00:13:06 2021
+++ src/tests/usr.bin/indent/token-while_expr.0	Sat Sep 25 13:26:07 2021
@@ -1,8 +1,9 @@
-/* $NetBSD: token-while_expr.0,v 1.1 2021/03/12 00:13:06 rillig Exp $ */
+/* $NetBSD: token-while_expr.0,v 1.2 2021/09/25 13:26:07 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
  * Tests for the keyword 'while', followed by a parenthesized expression.
  */
 
-/* TODO: Add some code to be formatted. */
+int main(int argc,char**argv){int o;while((o=getopt(argc,argv,"x:"))!=-1)
+switch(o){case'x':do{o++;}while(o<5);break;default:usage();}return 0;}
Index: src/tests/usr.bin/indent/token-while_expr.0.stdout
diff -u src/tests/usr.bin/indent/token-while_expr.0.stdout:1.1 src/tests/usr.bin/indent/token-while_expr.0.stdout:1.2
--- src/tests/usr.bin/indent/token-while_expr.0.stdout:1.1	Fri Mar 12 00:13:06 2021
+++ src/tests/usr.bin/indent/token-while_expr.0.stdout	Sat Sep 25 13:26:07 2021
@@ -1,8 +1,23 @@
-/* $NetBSD: token-while_expr.0.stdout,v 1.1 2021/03/12 00:13:06 rillig Exp $ */
+/* $NetBSD: token-while_expr.0.stdout,v 1.2 2021/09/25 13:26:07 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
  * Tests for the keyword 'while', followed by a parenthesized expression.
  */
 
-/* TODO: Add some code to be formatted. */
+int
+main(int argc, char **argv)
+{
+	int		o;
+	while ((o = getopt(argc, argv, "x:")) != -1)
+		switch (o) {
+		case 'x':
+			do {
+				o++;
+			} while (o < 5);
+			break;
+		default:
+			usage();
+/* $ XXX: The 'return' should be in a separate line. */
+		} return 0;
+}

Reply via email to