diff --git a/tests/ls/hyperlink.sh b/tests/ls/hyperlink.sh index bc1331147..eaedd0876 100755 --- a/tests/ls/hyperlink.sh +++ b/tests/ls/hyperlink.sh @@ -17,9 +17,7 @@ # along with this program. If not, see . . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -print_ver_ ls realpath - -hostname=$(hostname) || skip_ 'unable to determine hostname' +print_ver_ ls # lookup based on first letter encode() { @@ -32,30 +30,34 @@ encode() { ls_encoded() { ef=$(encode "$1") echo "$ef" | grep -q 'dir$' && dir=: || dir='' - printf '\033]8;;file://%s%s/%s\a%s\033]8;;\a%s\n' \ - $hostname $basepath $ef "$1" "$dir" + printf '\033]8;;file:///%s\a%s\033]8;;\a%s\n' \ + "$ef" "$1" "$dir" +} + +# These could be encoded, so remove from consideration +strip_host_and_path() { + sed 's|file://.*/|file:///|' } mkdir testdir || framework_failure_ -basepath=$(realpath -m .) || framework_failure_ ( cd testdir ls_encoded "testdir" > ../exp.t || framework_failure_ -basepath="$basepath/testdir" for f in 'back\slash' 'encoded%3Fquestion' 'ques?tion' 'sp ace'; do touch "$f" || framework_failure_ ls_encoded "$f" >> ../exp.t || framework_failure_ done ) ln -s testdir testdirl || framework_failure_ -(cat exp.t && echo && sed 's/[^\/]testdir/&l/' exp.t) > exp \ +(cat exp.t && printf '\n' && sed 's/[^\/]testdir/&l/' exp.t) > exp \ || framework_failure_ -ls --hyper testdir testdirl >out || fail=1 +ls --hyper testdir testdirl >out.t || fail=1 +strip_host_and_path out || framework_failure_ compare exp out || fail=1 -ln -s '/probably/missing' testlink || framework_failure_ -target=$(realpath -m testlink) || framework_failure_ -ls -l --hyper testlink > out || fail=1 -grep "file://.*$target" out || fail=1 +ln -s '/probably_missing' testlink || framework_failure_ +ls -l --hyper testlink > out.t || fail=1 +strip_host_and_path out || framework_failure_ +grep 'file:///probably_missing' out || fail=1 Exit $fail