Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/xlint tests/lint: use standard form of ATF tes...



details:   https://anonhg.NetBSD.org/src/rev/db7b390b792a
branches:  trunk
changeset: 376680:db7b390b792a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Jun 28 09:35:42 2023 +0000

description:
tests/lint: use standard form of ATF tests, test removing output file

diffstat:

 tests/usr.bin/xlint/lint1/t_usage.sh |  14 +++-----------
 tests/usr.bin/xlint/xlint/t_xlint.sh |  25 ++++++++-----------------
 2 files changed, 11 insertions(+), 28 deletions(-)

diffs (102 lines):

diff -r 2bb619114037 -r db7b390b792a tests/usr.bin/xlint/lint1/t_usage.sh
--- a/tests/usr.bin/xlint/lint1/t_usage.sh      Wed Jun 28 08:53:43 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/t_usage.sh      Wed Jun 28 09:35:42 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_usage.sh,v 1.7 2023/06/24 08:11:12 rillig Exp $
+# $NetBSD: t_usage.sh,v 1.8 2023/06/28 09:35:42 rillig Exp $
 #
 # Copyright (c) 2023 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -28,11 +28,7 @@
 : "${lint1:=/usr/libexec/lint1}"
 
 
-suppress_messages_head()
-{
-       :
-}
-
+atf_test_case 'suppress_messages'
 suppress_messages_body()
 {
        printf 'typedef int dummy;\n' > code.c
@@ -80,11 +76,7 @@ suppress_messages_body()
            "$lint1" -X '1,,,,,,,' code.c /dev/null
 }
 
-enable_queries_head()
-{
-       :
-}
-
+atf_test_case 'enable_queries'
 enable_queries_body()
 {
        printf 'typedef int dummy;\n' > code.c
diff -r 2bb619114037 -r db7b390b792a tests/usr.bin/xlint/xlint/t_xlint.sh
--- a/tests/usr.bin/xlint/xlint/t_xlint.sh      Wed Jun 28 08:53:43 2023 +0000
+++ b/tests/usr.bin/xlint/xlint/t_xlint.sh      Wed Jun 28 09:35:42 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_xlint.sh,v 1.1 2023/01/15 23:18:05 rillig Exp $
+# $NetBSD: t_xlint.sh,v 1.2 2023/06/28 09:35:43 rillig Exp $
 #
 # Copyright (c) 2023 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -25,13 +25,9 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-: ${lint:='/usr/bin/lint'}
+: "${lint:=/usr/bin/lint}"
 
-run_lint1_error_head()
-{
-       :
-}
-
+atf_test_case 'run_lint1_error'
 run_lint1_error_body()
 {
        cat <<-EOF >input.c || atf_fail 'prepare input.c'
@@ -43,24 +39,22 @@ run_lint1_error_body()
                        return 1;
                }
        EOF
+       echo 'previous content' > input.ln
 
        atf_check \
            -s 'exit:1' \
            -o "inline:input.c(6): error: function has return type '_Bool' but returns 'int' [211]\n" \
            "$lint" -aabceghiprSTxz input.c
 
-       # In case of an error, no output file is written.
+       # In case of an error, any previous output file is overwritten, and the
+       # (possibly unfinished) output file is removed.
        atf_check \
            -s 'exit:1' \
            test -f input.ln
 }
 
 
-run_lint1_warning_head()
-{
-       :
-}
-
+atf_test_case 'run_lint1_warning'
 run_lint1_warning_body()
 {
        cat <<-EOF >input.c || atf_fail 'prepare input.c'
@@ -88,11 +82,8 @@ run_lint1_warning_body()
            cat input.ln
 }
 
-run_lint2_head()
-{
-       :
-}
 
+atf_test_case 'run_lint2'
 run_lint2_body()
 {
        cat <<-EOF >input.ln || atf_fail 'prepare input.ln'



Home | Main Index | Thread Index | Old Index