summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-06-29 15:17:27 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-06-29 15:33:28 -0400
commit27dc7a126d6c00b7a41e0559254928555200ee42 (patch)
tree0edd749507260ce972ea8ae462c796a6c2171d7e /tests
parent32cd0cbacfc6a4637915b40b7781976731599435 (diff)
downloadbfs-27dc7a126d6c00b7a41e0559254928555200ee42.tar.xz
color: Implement smart casing
Since coreutils 9.2, ls does case-sensitive extension matching if the same extension is capitalized differently in $LS_COLORS. Implement the same logic. Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=33123 Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=9086
Diffstat (limited to 'tests')
-rw-r--r--tests/bfs/color_ext_case.out (renamed from tests/bfs/color_star.out)16
-rw-r--r--tests/bfs/color_ext_case.sh1
-rw-r--r--tests/bfs/color_nul.outbin20 -> 908 bytes
-rw-r--r--tests/bfs/color_nul.sh3
-rw-r--r--tests/bfs/color_star.sh2
5 files changed, 12 insertions, 10 deletions
diff --git a/tests/bfs/color_star.out b/tests/bfs/color_ext_case.out
index 34c7153..c3ded3a 100644
--- a/tests/bfs/color_star.out
+++ b/tests/bfs/color_ext_case.out
@@ -1,5 +1,13 @@
rainbow
+rainbow/lower.gz
+rainbow/lower.tar.gz
rainbow/exec.sh
+rainbow/upper.GZ
+rainbow/upper.TAR.GZ
+rainbow/lower.tar
+rainbow/upper.TAR
+rainbow/ul.TAR.gz
+rainbow/lu.tar.GZ
rainbow/socket
rainbow/broken
rainbow/chardev_link
@@ -13,13 +21,5 @@
rainbow/sticky
rainbow/file.dat
rainbow/file.txt
-rainbow/lower.gz
-rainbow/lower.tar
-rainbow/lower.tar.gz
-rainbow/lu.tar.GZ
rainbow/mh1
rainbow/mh2
-rainbow/ul.TAR.gz
-rainbow/upper.GZ
-rainbow/upper.TAR
-rainbow/upper.TAR.GZ
diff --git a/tests/bfs/color_ext_case.sh b/tests/bfs/color_ext_case.sh
new file mode 100644
index 0000000..91f1f59
--- /dev/null
+++ b/tests/bfs/color_ext_case.sh
@@ -0,0 +1 @@
+LS_COLORS="*.gz=01;31:*.GZ=01;32:*.tAr=01;33:*.TAR.gz=01;34:*.tar.GZ=01;35:" bfs_diff rainbow -color
diff --git a/tests/bfs/color_nul.out b/tests/bfs/color_nul.out
index c328f82..4ea4d85 100644
--- a/tests/bfs/color_nul.out
+++ b/tests/bfs/color_nul.out
Binary files differ
diff --git a/tests/bfs/color_nul.sh b/tests/bfs/color_nul.sh
index 4979569..cb662d6 100644
--- a/tests/bfs/color_nul.sh
+++ b/tests/bfs/color_nul.sh
@@ -1,2 +1,3 @@
-LS_COLORS="ec=\33[m\0:" invoke_bfs rainbow -color -maxdepth 0 >"$OUT"
+LS_COLORS="ec=\33[\0m:*.gz=\0\61;31:" invoke_bfs rainbow -color | tr '\0' '0' >"$OUT"
+sort_output
diff_output
diff --git a/tests/bfs/color_star.sh b/tests/bfs/color_star.sh
index 3ada4fd..6d5312e 100644
--- a/tests/bfs/color_star.sh
+++ b/tests/bfs/color_star.sh
@@ -1,2 +1,2 @@
# Regression test: don't segfault on LS_COLORS="*"
-LS_COLORS="*" bfs_diff rainbow -color
+! LS_COLORS="*" invoke_bfs rainbow -color