Collin Funk <[email protected]> writes: > +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src > +print_ver_ truncate > + > +returns_ 1 truncate -s0 a . b || fail=1 > +test -f a || fail=1 > +test -f b || fail=1
I also pushed the attatched patch, since I figured we might as well check for a reasonable error message while we are here. Collin
>From 5ec45a1aa5989e258013b68831b74527d4bdfade Mon Sep 17 00:00:00 2001 Message-ID: <5ec45a1aa5989e258013b68831b74527d4bdfade.1773987629.git.collin.fu...@gmail.com> From: Collin Funk <[email protected]> Date: Thu, 19 Mar 2026 23:14:52 -0700 Subject: [PATCH] test: truncate: improve the test added in the previous commit * tests/truncate/multiple-files.sh: Check that nothing is printed to standard output and that standard error has the correct error. --- tests/truncate/multiple-files.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/truncate/multiple-files.sh b/tests/truncate/multiple-files.sh index dfde9fac2..d7a984c42 100755 --- a/tests/truncate/multiple-files.sh +++ b/tests/truncate/multiple-files.sh @@ -18,9 +18,16 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ truncate +getlimits_ -returns_ 1 truncate -s0 a . b || fail=1 +returns_ 1 truncate -s0 a . b > out 2> err || fail=1 test -f a || fail=1 test -f b || fail=1 +compare /dev/null out || fail=1 +cat <<EOF > exp-err || framework_failure_ +truncate: cannot open '.' for writing: $EISDIR +EOF +compare exp-err err || fail=1 + Exit $fail -- 2.53.0
