Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/usr.bin/indent tests/indent: allow for comments in eit...
details: https://anonhg.NetBSD.org/src/rev/6517354cc37d
branches: trunk
changeset: 960060:6517354cc37d
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Mar 07 08:57:38 2021 +0000
description:
tests/indent: allow for comments in either the input or output files
diffstat:
tests/usr.bin/indent/comment-line-end.0 | 12 ++----------
tests/usr.bin/indent/comment-line-end.0.stdout | 15 +++++----------
tests/usr.bin/indent/t_indent.sh | 12 ++++++++----
3 files changed, 15 insertions(+), 24 deletions(-)
diffs (95 lines):
diff -r 63b2981f861e -r 6517354cc37d tests/usr.bin/indent/comment-line-end.0
--- a/tests/usr.bin/indent/comment-line-end.0 Sun Mar 07 08:48:36 2021 +0000
+++ b/tests/usr.bin/indent/comment-line-end.0 Sun Mar 07 08:57:38 2021 +0000
@@ -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 @@
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.
diff -r 63b2981f861e -r 6517354cc37d tests/usr.bin/indent/comment-line-end.0.stdout
--- a/tests/usr.bin/indent/comment-line-end.0.stdout Sun Mar 07 08:48:36 2021 +0000
+++ b/tests/usr.bin/indent/comment-line-end.0.stdout Sun Mar 07 08:57:38 2021 +0000
@@ -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 @@
{
}
-/*
- * 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){
}
diff -r 63b2981f861e -r 6517354cc37d tests/usr.bin/indent/t_indent.sh
--- a/tests/usr.bin/indent/t_indent.sh Sun Mar 07 08:48:36 2021 +0000
+++ b/tests/usr.bin/indent/t_indent.sh Sun Mar 07 08:57:38 2021 +0000
@@ -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 @@
# 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 @@
# 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
}
Home |
Main Index |
Thread Index |
Old Index