Module Name: src
Committed By: rillig
Date: Sun Mar 7 08:57:38 UTC 2021
Modified Files:
src/tests/usr.bin/indent: comment-line-end.0 comment-line-end.0.stdout
t_indent.sh
Log Message:
tests/indent: allow for comments in either the input or output files
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/comment-line-end.0 \
src/tests/usr.bin/indent/comment-line-end.0.stdout
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/t_indent.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/comment-line-end.0
diff -u src/tests/usr.bin/indent/comment-line-end.0:1.2 src/tests/usr.bin/indent/comment-line-end.0:1.3
--- src/tests/usr.bin/indent/comment-line-end.0:1.2 Sat Mar 6 15:02:38 2021
+++ src/tests/usr.bin/indent/comment-line-end.0 Sun Mar 7 08:57:38 2021
@@ -1,5 +1,5 @@
-/* $NetBSD: comment-line-end.0,v 1.2 2021/03/06 15:02:38 rillig Exp $ */
-/* This $FreeBSD$ tag is required by the test suite, for no reason. */
+/* $NetBSD: comment-line-end.0,v 1.3 2021/03/07 08:57:38 rillig Exp $ */
+/* $FreeBSD$ */
/*
* Demonstrates handling of line-end comments.
@@ -18,14 +18,6 @@ int dummy // comment
void function(void){}
-/*
- * FIXME: The '{' of main must be in column 1, not directly after the ')'.
- *
- * FIXME: The 'Note: removing' below gets "indented" to 'Note:removing'.
- *
- * FIXME: The 'line-end' gets "indented" to 'line - end'.
- */
-
// Note: removing one of these line-end comments affects the formatting
// of the main function below.
Index: src/tests/usr.bin/indent/comment-line-end.0.stdout
diff -u src/tests/usr.bin/indent/comment-line-end.0.stdout:1.2 src/tests/usr.bin/indent/comment-line-end.0.stdout:1.3
--- src/tests/usr.bin/indent/comment-line-end.0.stdout:1.2 Sat Mar 6 15:02:38 2021
+++ src/tests/usr.bin/indent/comment-line-end.0.stdout Sun Mar 7 08:57:38 2021
@@ -1,5 +1,5 @@
-/* $NetBSD: comment-line-end.0.stdout,v 1.2 2021/03/06 15:02:38 rillig Exp $ */
-/* This $FreeBSD$ tag is required by the test suite, for no reason. */
+/* $NetBSD: comment-line-end.0.stdout,v 1.3 2021/03/07 08:57:38 rillig Exp $ */
+/* $FreeBSD$ */
/*
* Demonstrates handling of line-end comments.
@@ -22,17 +22,12 @@ function(void)
{
}
-/*
- * FIXME: The '{' of main must be in column 1, not directly after the ')'.
- *
- * FIXME: The 'Note: removing' below gets "indented" to 'Note:removing'.
- *
- * FIXME: The 'line-end' gets "indented" to 'line - end'.
- */
-
+/* $ FIXME: The space between 'Note: removing' must be preserved. */
+/* $ FIXME: The spacing around the '-' in 'line-end' must be preserved. */
//Note:removing one of these line - end comments affects the formatting
// of the main function below.
int
+/* $ FIXME: The '{' must be in column 1, not directly after the ')'. */
main(void){
}
Index: src/tests/usr.bin/indent/t_indent.sh
diff -u src/tests/usr.bin/indent/t_indent.sh:1.1 src/tests/usr.bin/indent/t_indent.sh:1.2
--- src/tests/usr.bin/indent/t_indent.sh:1.1 Thu Apr 4 15:27:35 2019
+++ src/tests/usr.bin/indent/t_indent.sh Sun Mar 7 08:57:38 2021
@@ -1,3 +1,5 @@
+#! /bin/sh
+# $NetBSD: t_indent.sh,v 1.2 2021/03/07 08:57:38 rillig Exp $
#
# Copyright 2016 Dell EMC
# All rights reserved.
@@ -38,13 +40,15 @@ check()
# to pass.
atf_check cp ${SRCDIR}/${tc}* .
- # Remove $FreeBSD: head/usr.bin/indent/tests/functional_test.sh 314613 2017-03-03 20:15:22Z ngie $ RCS expansions because they get re-indented, which
- # changes the output
+ # Remove single-line comments that start with '$'. This removes RCS
+ # IDs, preventing them to be broken into several lines. It also
+ # allows for remarks that are only needed in either the input or the
+ # output. These removals affect the line numbers in the diffs.
local out_file="${tc}.stdout"
if [ -f "${out_file}" ]; then
parsed_file=output_file.parsed
- atf_check -o save:$parsed_file sed -e '/\$NetBSD.*\$/,/\$FreeBSD.*\$/d' \
+ atf_check -o save:$parsed_file sed -e '/^\/\*[[:space:]]$.*/d' \
${tc}.stdout
out_flag="-o file:$parsed_file"
fi
@@ -56,7 +60,7 @@ check()
# host, for determinism purposes.
profile_flag="-npro"
fi
- sed -e '/\$NetBSD.*\$/,/\$FreeBSD.*\$/d' ${tc} > input_file.parsed
+ sed -e '/^\/\*[[:space:]]$.*/d' ${tc} > input_file.parsed
atf_check -s exit:${tc##*.} ${out_flag} ${indent} ${profile_flag} < input_file.parsed
}