summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2023-06-28 09:35:42 +0000
committerrillig <rillig@NetBSD.org>2023-06-28 09:35:42 +0000
commitb2799d89c8db5a819d3b995af57fc3e63bbdfd8f (patch)
tree20e11d5bf3b9be70090063cbfe95ad8a96a70048 /tests
parentb898bd1a735594a022f169642a8f6362b3fe61a5 (diff)
tests/lint: use standard form of ATF tests, test removing output file
Diffstat (limited to 'tests')
-rw-r--r--tests/usr.bin/xlint/lint1/t_usage.sh14
-rw-r--r--tests/usr.bin/xlint/xlint/t_xlint.sh25
2 files changed, 11 insertions, 28 deletions
diff --git a/tests/usr.bin/xlint/lint1/t_usage.sh b/tests/usr.bin/xlint/lint1/t_usage.sh
index f7c73bec854..597c9c7b7b3 100644
--- a/tests/usr.bin/xlint/lint1/t_usage.sh
+++ b/tests/usr.bin/xlint/lint1/t_usage.sh
@@ -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 --git a/tests/usr.bin/xlint/xlint/t_xlint.sh b/tests/usr.bin/xlint/xlint/t_xlint.sh
index e8fd8bdc9b5..522d02419cd 100644
--- a/tests/usr.bin/xlint/xlint/t_xlint.sh
+++ b/tests/usr.bin/xlint/xlint/t_xlint.sh
@@ -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'}
-
-run_lint1_error_head()
-{
- :
-}
+: "${lint:=/usr/bin/lint}"
+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'