summaryrefslogtreecommitdiff
path: root/tests/split/suffix-auto-length.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/split/suffix-auto-length.sh')
-rwxr-xr-xtests/split/suffix-auto-length.sh25
1 files changed, 18 insertions, 7 deletions
diff --git a/tests/split/suffix-auto-length.sh b/tests/split/suffix-auto-length.sh
index 40d95af9..6ef221a1 100755
--- a/tests/split/suffix-auto-length.sh
+++ b/tests/split/suffix-auto-length.sh
@@ -1,7 +1,7 @@
#!/bin/sh
-# Test the suffix auto widening functionality
+# Test the suffix auto width functionality
-# Copyright (C) 2012-2014 Free Software Foundation, Inc.
+# Copyright (C) 2012-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,14 +20,14 @@
print_ver_ split
-# ensure this feature is off when start number specified
-truncate -s12 file.in
-split file.in -b1 --numeric=89 && fail=1
+# ensure auto widening is off when start number specified
+truncate -s12 file.in || framework_failure_
+returns_ 1 split file.in -b1 --numeric=89 || fail=1
test "$(ls -1 x* | wc -l)" = 11 || fail=1
rm -f x*
-# ensure this feature works when no start num specified
-truncate -s91 file.in
+# ensure auto widening works when no start num specified
+truncate -s91 file.in || framework_failure_
for prefix in 'x' 'xx' ''; do
for add_suffix in '.txt' ''; do
split file.in "$prefix" -b1 --numeric --additional-suffix="$add_suffix" \
@@ -39,4 +39,15 @@ for prefix in 'x' 'xx' ''; do
done
done
+# ensure auto width with --number and start num < number of files
+# That's the single run use case which is valid to adjust suffix len
+truncate -s100 file.in || framework_failure_
+split --numeric-suffixes=1 --number=r/100 file.in || fail=1
+rm -f x*
+
+# ensure no auto width with --number and start num >= number of files
+# That's the multi run use case which is invalid to adjust suffix len
+# as that would result in an incorrect order for the total output file set
+returns_ 1 split --numeric-suffixes=100 --number=r/100 file.in || fail=1
+
Exit $fail