summaryrefslogtreecommitdiff
path: root/tests/ls
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-04-01 06:47:25 +0000
committerJim Meyering <jim@meyering.net>1998-04-01 06:47:25 +0000
commiteb3a4daa2473d2a280e01f370a4edcffd34b5828 (patch)
tree4fdcb19d9439b45ab4049ff2d7110e54756b63f3 /tests/ls
parentb6844f1931c4a95e54d65e90e8765dda8eea0223 (diff)
downloadcoreutils-eb3a4daa2473d2a280e01f370a4edcffd34b5828.tar.xz
.
Diffstat (limited to 'tests/ls')
-rw-r--r--tests/ls/Makefile.in2
-rwxr-xr-xtests/ls/cr-152
2 files changed, 53 insertions, 1 deletions
diff --git a/tests/ls/Makefile.in b/tests/ls/Makefile.in
index 986d35474..f064e73ac 100644
--- a/tests/ls/Makefile.in
+++ b/tests/ls/Makefile.in
@@ -91,7 +91,7 @@ l = @l@
AUTOMAKE_OPTIONS = 1.2 gnits
-TESTS = time-1
+TESTS = cr-1 time-1
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = LS=../../src/ls TOUCH=../../src/touch
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/tests/ls/cr-1 b/tests/ls/cr-1
new file mode 100755
index 000000000..202b3d8d2
--- /dev/null
+++ b/tests/ls/cr-1
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Make sure name is used as secondary key when sorting on mtime or ctime.
+
+: ${LS=ls}
+: ${TOUCH=touch}
+
+if test "$VERBOSE" = yes; then
+ set -x
+ $LS --version
+fi
+
+tmp=t-ls.$$
+
+# We're going to run LS from a subdir.
+# Prepend ../ if $LS is a relative file name.
+case $LS in
+ /*) ;;
+ */*) LS=../$LS
+esac
+
+case $TOUCH in
+ /*) ;;
+ */*) TOUCH=../$TOUCH
+esac
+
+test_failure=0
+mkdir $tmp || test_failure=1
+cd $tmp || test_failure=1
+
+date=1998-01-15
+
+$TOUCH -d "$date" c || test_failure=1
+$TOUCH -d "$date" a || test_failure=1
+$TOUCH -d "$date" b || test_failure=1
+
+if test $test_failure = 1; then
+ echo 'failure in testing framework'
+ exit 1
+fi
+
+fail=0
+
+set `$LS -c a b c`
+test "$*" = 'a b c' && : || fail=1
+
+set `$LS -rc a b c`
+test "$*" = 'c b a' && : || fail=1
+
+cd ..
+rm -rf $tmp
+
+exit $fail