]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: truncate: ensure negative args not parsed as options
authorPádraig Brady <P@draigBrady.com>
Mon, 3 Nov 2025 13:51:14 +0000 (13:51 +0000)
committerPádraig Brady <P@draigBrady.com>
Mon, 3 Nov 2025 13:52:54 +0000 (13:52 +0000)
* tests/truncate/truncate-parameters.sh: Add a test case.

tests/truncate/truncate-parameters.sh

index 1b67c105c3b217b7f2ca92464af8b7282bdc0ebd..50c4f9669971a732afa0fc4e85edd10c5f5a026a 100755 (executable)
@@ -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