summaryrefslogtreecommitdiff
path: root/tests/ls
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2009-06-11 11:34:21 +0100
committerPádraig Brady <P@draigBrady.com>2009-06-11 11:39:24 +0100
commitba1c5239bc4b9719a20cedd35a313fa4237e7151 (patch)
tree8c58f5920c7d2e42d9e3360595d7836e1e4c95fe /tests/ls
parent0df338f6719ec2bcf1e1dea2d8b12dc66daf8a1e (diff)
downloadcoreutils-ba1c5239bc4b9719a20cedd35a313fa4237e7151.tar.xz
tests: ls --color, permissions override hardlink coloring
* tests/ls/multihardlink: Add a test case to demonstrate and test this non obvious behavior.
Diffstat (limited to 'tests/ls')
-rwxr-xr-xtests/ls/multihardlink12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ls/multihardlink b/tests/ls/multihardlink
index d237a71a9..815222db0 100755
--- a/tests/ls/multihardlink
+++ b/tests/ls/multihardlink
@@ -27,10 +27,12 @@ working_umask_or_skip_
touch file file1 || framework_failure
ln file1 file2 || skip_test_ "can't create hard link"
code_mh='44;37'
+code_ex='01;32'
code_png='01;35'
c0=$(printf '\033[0m')
c_end=$(printf '\033[m')
c_mh=$(printf '\033[%sm' $code_mh)
+c_ex=$(printf '\033[%sm' $code_ex)
c_png=$(printf '\033[%sm' $code_png)
fail=0
@@ -55,6 +57,16 @@ ${c_mh}file2.png$c0
$c_end" > out_ok || framework_failure
compare out out_ok || fail=1
+# hard links and exe (exe coloring takes precedence)
+chmod a+x file2.png || framework_failure
+LS_COLORS="mh=$code_mh:*.png=$code_png:ex=$code_ex" \
+ ls -U1 --color=always file1 file2.png > out || fail=1
+chmod a-x file2.png || framework_failure
+printf "$c0${c_ex}file1$c0
+${c_ex}file2.png$c0
+$c_end" > out_ok || framework_failure
+compare out out_ok || fail=1
+
# hard links and png (hard link coloring disabled => png coloring enabled)
LS_COLORS="mh=00:*.png=$code_png" ls -U1 --color=always file1 file2.png > out \
|| fail=1