aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2025-11-03 13:51:14 +0000
committerPádraig Brady <P@draigBrady.com>2025-11-03 13:52:54 +0000
commit77322b31193cc4e89daa9f15fca7853023bcb42d (patch)
treedb8bde1ff897e0af82ec9ff50bffb7862fb5bb01
parentdate: avoid a duplicated write error diagnotic (diff)
downloadcoreutils-77322b31193cc4e89daa9f15fca7853023bcb42d.tar.gz
coreutils-77322b31193cc4e89daa9f15fca7853023bcb42d.zip
tests: truncate: ensure negative args not parsed as options
* tests/truncate/truncate-parameters.sh: Add a test case.
-rwxr-xr-xtests/truncate/truncate-parameters.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/truncate/truncate-parameters.sh b/tests/truncate/truncate-parameters.sh
index 1b67c105c..50c4f9669 100755
--- a/tests/truncate/truncate-parameters.sh
+++ b/tests/truncate/truncate-parameters.sh
@@ -51,4 +51,8 @@ test $(stat --format %s file) = 3 || fail=1
truncate -r file file2 || fail=1 #file2 now 3
test $(stat --format %s file2) = 3 || fail=1
+# Ensure separated argument not parsed as option
+truncate -s -1 file || fail=1 #file now 2
+test $(stat --format %s file) = 2 || fail=1
+
Exit $fail