The branch main has been updated by des:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0ecc679fd3da0720d6ba331ebcceca8e0760fa22

commit 0ecc679fd3da0720d6ba331ebcceca8e0760fa22
Author:     Dag-Erling Smørgrav <d...@freebsd.org>
AuthorDate: 2025-08-07 23:33:56 +0000
Commit:     Dag-Erling Smørgrav <d...@freebsd.org>
CommitDate: 2025-08-07 23:33:56 +0000

    indent: Simplify test script
    
    Much of the test script was concerned with working around RCS tags and
    dealing with cases which don't apply to indent.
    
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D51795
---
 usr.bin/indent/tests/functional_test.sh | 55 +++++++++------------------------
 1 file changed, 15 insertions(+), 40 deletions(-)

diff --git a/usr.bin/indent/tests/functional_test.sh 
b/usr.bin/indent/tests/functional_test.sh
index 44538e5b6e12..3f4431038234 100755
--- a/usr.bin/indent/tests/functional_test.sh
+++ b/usr.bin/indent/tests/functional_test.sh
@@ -1,3 +1,5 @@
+#-
+# SPDX-License-Identifier: BSD-2-Clause
 #
 # Copyright 2016 Dell EMC
 # All rights reserved.
@@ -29,61 +31,34 @@ SRCDIR=$(atf_get_srcdir)
 
 check()
 {
-       local tc=${1}; shift
-
-       local indent=$(atf_config_get usr.bin.indent.test_indent 
/usr/bin/indent)
-
-       # All of the files need to be in the ATF sandbox in order for the tests
-       # to pass.
-       atf_check cp ${SRCDIR}/${tc}* .
+       local tc=${1}
+       local profile_flag
 
-       # Remove $FreeBSD$ RCS expansions because they get re-indented, which
-       # changes the output
-       local out_file="${tc}.stdout"
-       if [ -f "${out_file}" ]; then
-               parsed_file=output_file.parsed
+       cp "${SRCDIR}/${tc%.[0-9]}".* .
 
-               atf_check -o save:$parsed_file sed -e '/\$FreeBSD.*\$/d' \
-                   ${tc}.stdout
-               out_flag="-o file:$parsed_file"
-       fi
-       local profile_file="${tc}.pro"
-       if [ -f "${profile_file}" ]; then
-               profile_flag="-P${profile_file}"
+       if [ -f "${tc}.pro" ]; then
+               profile_flag="-P${tc}.pro"
        else
                # Make sure we don't implicitly use ~/.indent.pro from the test
                # host, for determinism purposes.
                profile_flag="-npro"
        fi
-       sed -e '/\$FreeBSD.*\$/d' ${tc} > input_file.parsed
-       atf_check -s exit:${tc##*.} ${out_flag} ${indent} ${profile_flag} < 
input_file.parsed
+       atf_check -s exit:${tc##*.} -o file:"${tc}.stdout" \
+           indent ${profile_flag} < "${tc}"
 }
 
-add_testcase()
+add_legacy_testcase()
 {
        local tc=${1}
-       local tc_escaped word
-
-       case "${tc%.*}" in
-       *-*)
-               local IFS="-"
-               for word in ${tc%.*}; do
-                       tc_escaped="${tc_escaped:+${tc_escaped}_}${word}"
-               done
-               ;;
-       *)
-               tc_escaped=${tc%.*}
-               ;;
-       esac
 
-       atf_test_case ${tc_escaped}
-       eval "${tc_escaped}_body() { check ${tc}; }"
-       atf_add_test_case ${tc_escaped}
+       atf_test_case ${tc%.[0-9]}
+       eval "${tc%.[0-9]}_body() { check ${tc}; }"
+       atf_add_test_case ${tc%.[0-9]}
 }
 
 atf_init_test_cases()
 {
-       for path in $(find -Es "${SRCDIR}" -regex '.*\.[0-9]+$'); do
-               add_testcase ${path##*/}
+       for tc in $(find -s "${SRCDIR}" -name '*.[0-9]'); do
+               add_legacy_testcase "${tc##*/}"
        done
 }

Reply via email to