From e2f526768e1d91893dc2772962be8155205b9c50 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 3 Sep 2019 17:08:10 -0400 Subject: color: Fix directory coloring when resolving symlinks at the root --- tests.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests.sh') 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 -- cgit v1.2.3