summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVinX <vinx83@gmail.com>2025-07-03 12:31:19 +0000
committerVinX <vinx83@gmail.com>2025-07-03 12:31:19 +0000
commitb4a8afc2cfdbd91dedf2f387427c0984cad6d54a (patch)
tree5f16fa741463837e53316d0db6f8776152637dfc /tests
parent42235435aab09bc48765707b6706eaa1ecf1a0a7 (diff)
downloadbfs-b4a8afc2cfdbd91dedf2f387427c0984cad6d54a.tar.xz
Support for FreeBSD-style ls Coloring
If LSCOLORS is undefined or partially defined (missing some of the eleven expected value pairs), the patch will automatically fill in those missing values with default colors. However, if the LS_COLORS environment variable is already defined, the application prefer the LS_COLORS approach, maintaining current working flow of the program.
Diffstat (limited to 'tests')
-rw-r--r--tests/bfs/color_bsd.out27
-rw-r--r--tests/bfs/color_bsd.sh1
-rw-r--r--tests/bfs/color_bsd_fail.sh2
-rw-r--r--tests/util.sh1
4 files changed, 31 insertions, 0 deletions
diff --git a/tests/bfs/color_bsd.out b/tests/bfs/color_bsd.out
new file mode 100644
index 0000000..f7c577c
--- /dev/null
+++ b/tests/bfs/color_bsd.out
@@ -0,0 +1,27 @@
+$'rainbow/\e[1m'
+$'rainbow/\e[1m/'$'\e[0m'
+rainbow
+rainbow/sugid
+rainbow/suid
+rainbow/sticky_ow
+rainbow/ow
+rainbow/sgid
+rainbow/exec.sh
+rainbow/socket
+rainbow/pipe
+rainbow/broken
+rainbow/chardev_link
+rainbow/link.txt
+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_bsd.sh b/tests/bfs/color_bsd.sh
new file mode 100644
index 0000000..f8a777f
--- /dev/null
+++ b/tests/bfs/color_bsd.sh
@@ -0,0 +1 @@
+LSCOLORS="eB" bfs_diff rainbow -color
diff --git a/tests/bfs/color_bsd_fail.sh b/tests/bfs/color_bsd_fail.sh
new file mode 100644
index 0000000..94e1209
--- /dev/null
+++ b/tests/bfs/color_bsd_fail.sh
@@ -0,0 +1,2 @@
+# LSCOLORS can be at most 22 characters long (11 color pairs); this one has 24.
+! LSCOLORS="exfxcxdxbxegedabagacadeB" invoke_bfs rainbow -color
diff --git a/tests/util.sh b/tests/util.sh
index 1718a1a..c998927 100644
--- a/tests/util.sh
+++ b/tests/util.sh
@@ -34,6 +34,7 @@ stdenv() {
export LS_COLORS=""
unset BFS_COLORS
+ unset LSCOLORS
if [ "$UNAME" = Darwin ]; then
# ASan on macOS likes to report