summaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2019-09-03 17:08:10 -0400
committerTavian Barnes <tavianator@tavianator.com>2019-09-03 17:11:12 -0400
commite2f526768e1d91893dc2772962be8155205b9c50 (patch)
tree257133be87499976dcb99803cced2798b88fd7e8 /tests.sh
parentf7f1e3cfa25cf95e15bac30e6934d5a534ceca08 (diff)
downloadbfs-e2f526768e1d91893dc2772962be8155205b9c50.tar.xz
color: Fix directory coloring when resolving symlinks at the root
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests.sh b/tests.sh
index 409e1b2..b970547 100755
--- a/tests.sh
+++ b/tests.sh
@@ -618,6 +618,7 @@ bfs_tests=(
test_color_no_stat
test_color_L_no_stat
test_color_star
+ test_color_ls
test_execdir_plus
@@ -2105,6 +2106,30 @@ function test_color_star() {
LS_COLORS="*" bfs_diff rainbow -color
}
+function test_color_ls() {
+ rm -rf scratch/*
+ touchp scratch/foo/bar/baz
+ ln -s foo/bar/baz scratch/link
+ ln -s foo/bar/nowhere scratch/broken
+ ln -s foo/bar/nowhere/nothing scratch/nested
+ ln -s foo/bar/baz/qux scratch/notdir
+ ln -s scratch/foo/bar scratch/relative
+ ln -s /__bfs__/nowhere scratch/absolute
+
+ local EXPECTED="$TESTS/${FUNCNAME[0]}.out"
+ if [ "$UPDATE" ]; then
+ local ACTUAL="$EXPECTED"
+ else
+ local ACTUAL="$TMP/${FUNCNAME[0]}.out"
+ fi
+
+ LS_COLORS="or=01;31:" invoke_bfs scratch/{link,broken,nested,notdir,relative,absolute} -color -ls | sed 's/.* -> //' >"$ACTUAL"
+
+ if [ ! "$UPDATE" ]; then
+ diff -u "$EXPECTED" "$ACTUAL"
+ fi
+}
+
function test_deep() {
closefrom 4