aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndrew Ilijic <ilijic.andrew@gmail.com>2019-10-28 22:20:38 -0400
committerRob Landley <rob@landley.net>2019-10-28 23:36:36 -0500
commitab3e920602e447ad85e17923095b886e07dd586e (patch)
tree1c47e47ee1c6ab11d0fed6cd396e0ab534f30319 /tests
parentf95d580892e253655cd8298ad03d0fed65ca5026 (diff)
downloadtoybox-ab3e920602e447ad85e17923095b886e07dd586e.tar.gz
ls: Add `-w` which sets the column width
Diffstat (limited to 'tests')
-rwxr-xr-xtests/ls.test3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/ls.test b/tests/ls.test
index 91f69183..ce88b04b 100755
--- a/tests/ls.test
+++ b/tests/ls.test
@@ -31,6 +31,9 @@ testing "with -k" "$IN && ls -k; $OUT" "dir1\ndir2\nfile1.txt\nfile2.txt\n" "" "
testing "with -m" "$IN && ls -m; $OUT" "dir1, dir2, file1.txt, file2.txt\n" "" ""
testing "with -F" "$IN && ls -F; $OUT" "dir1/\ndir2/\nfile1.txt\nfile2.txt\n" "" ""
testing "with -dk *" "$IN && ls -dk *; $OUT" "dir1\ndir2\nfile1.txt\nfile2.txt\n" "" ""
+# TODO(ilijic) Remove `sed` commands in `-w` tests after trailing space patch is applied
+testing "with -w - one column" "$IN && ls -xw 5 | sed 's/^[ \t]*//;s/[ \t]*$//' && $OUT" "dir1\ndir2\nfile1.txt\nfile2.txt\n" "" ""
+testing "with -w - two columns" "$IN && ls -Cw 32 | sed 's/^[ \t]*//;s/[ \t]*$//' && $OUT" "dir1 file1.txt\ndir2 file2.txt\n" "" ""
testing "with -Z" "$IN && ls -Z file1.txt | egrep -q '^[^ ]+ file1.txt' || echo fail; $OUT" "" "" ""
testing "with -lZ" "$IN && ls --full-time -lZ file1.txt | egrep -q '^-[rwx-]+ +[0-9]+ +[^ ]+ +[^ ]+ +[^ ]+ +[0-9]+ [0-9][0-9][0-9][0-9]-[0-9][0-9]-.* file1.txt' || echo fail; $OUT" "" "" ""