From ba1c5239bc4b9719a20cedd35a313fa4237e7151 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Thu, 11 Jun 2009 11:34:21 +0100 Subject: tests: ls --color, permissions override hardlink coloring * tests/ls/multihardlink: Add a test case to demonstrate and test this non obvious behavior. --- tests/ls/multihardlink | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/ls') 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 -- cgit v1.2.3-54-g00ecf