2 # Ensure "ls --color" properly colors file name extensions.
4 # Copyright (C) 2018-2023 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
21 working_umask_or_skip_
23 touch img1.jpg IMG2.JPG img3.JpG file1.z file2.Z || framework_failure_
27 c0
=$
(printf '\033[0m')
28 c_jpg
=$
(printf '\033[%sm' $code_jpg)
29 c_JPG
=$
(printf '\033[%sm' $code_JPG)
30 c_z
=$
(printf '\033[%sm' $code_z)
32 # Case insenitive extensions
33 LS_COLORS
="*.jpg=$code_jpg:*.Z=$code_z" ls -U1 --color=always \
34 img1.jpg IMG2.JPG file1.z file2.Z
> out || fail
=1
40 " > out_ok || framework_failure_
41 compare out out_ok || fail
=1
43 # Case sensitive extensions
44 LS_COLORS
="*.jpg=$code_jpg:*.JPG=$code_JPG" ls -U1 --color=always \
45 img1.jpg IMG2.JPG img3.JpG
> out || fail
=1
50 " > out_ok || framework_failure_
51 compare out out_ok || fail
=1
53 # Case insensitive extensions (due to same sequences)
54 LS_COLORS
="*.jpg=$code_jpg:*.JPG=$code_jpg" ls -U1 --color=always \
55 img1.jpg IMG2.JPG img3.JpG
> out || fail
=1
60 " > out_ok || framework_failure_
61 compare out out_ok || fail
=1
63 # Case insensitive extensions (due to same sequences (after ignored sequences))
64 # Note later entries in LS_COLORS take precedence.
65 LS_COLORS
="*.jpg=$code_jpg:*.jpg=$code_JPG:*.JPG=$code_JPG" \
66 ls -U1 --color=always img1.jpg IMG2.JPG img3.JpG
> out || fail
=1
71 " > out_ok || framework_failure_
72 compare out out_ok || fail
=1
74 # Case sensitive extensions (due to diff sequences (after ignored sequences))
75 # Note later entries in LS_COLORS take precedence.
76 LS_COLORS
="*.jpg=$code_JPG:*.jpg=$code_jpg:*.JPG=$code_JPG" \
77 ls -U1 --color=always img1.jpg IMG2.JPG img3.JpG
> out || fail
=1
82 " > out_ok || framework_failure_
83 compare out out_ok || fail
=1