|
|
#!/bin/sh |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src |
|
|
print_ver_ ls |
|
|
|
|
|
|
|
|
|
|
|
mkdir dir || framework_failure_ |
|
|
|
|
|
cat <<EOF > exp |
|
|
dir: |
|
|
total 0 |
|
|
//SUBDIRED// 2 5 |
|
|
//DIRED-OPTIONS// --quoting-style=literal |
|
|
EOF |
|
|
for opt in '-l' '' '--hyperlink' '-x'; do |
|
|
LC_MESSAGES=C ls $opt -R --dired dir > out || fail=1 |
|
|
compare exp out || fail=1 |
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
touch dir/1a dir/2æ || framework_failure_ |
|
|
mkdir -p dir/3dir || framework_failure_ |
|
|
touch dir/aaa || framework_failure_ |
|
|
ln -s target dir/0aaa_link || framework_failure_ |
|
|
|
|
|
ls -l --dired dir > out || fail=1 |
|
|
|
|
|
dired_values=$(grep "//DIRED//" out| cut -d' ' -f2-) |
|
|
expected_files="0aaa_link 1a 2æ 3dir aaa" |
|
|
|
|
|
dired_count=$(printf '%s\n' $dired_values | wc -l) |
|
|
expected_count=$(printf '%s\n' $expected_files | wc -l) |
|
|
|
|
|
if test "$expected_count" -ne $(($dired_count / 2)); then |
|
|
echo "Mismatch in number of files!" \ |
|
|
"Expected: $expected_count, Found: $(($dired_count / 2))" |
|
|
fail=1 |
|
|
fi |
|
|
|
|
|
|
|
|
index=1 |
|
|
set -- $dired_values |
|
|
while test "$#" -gt 0; do |
|
|
extracted_filename=$(head -c "$2" out | tail -c+"$(($1 + 1))") |
|
|
expected_file=$(echo $expected_files | cut -d' ' -f$index) |
|
|
|
|
|
|
|
|
if echo "$extracted_filename" | grep ' -> ' > /dev/null; then |
|
|
extracted_filename=$(echo "$extracted_filename" | cut -d' ' -f1) |
|
|
fi |
|
|
|
|
|
if test "$extracted_filename" != "$expected_file"; then |
|
|
echo "Mismatch! Expected: $expected_file, Found: $extracted_filename" |
|
|
fail=1 |
|
|
fi |
|
|
shift; shift |
|
|
index=$(($index + 1)) |
|
|
done |
|
|
|
|
|
|
|
|
Exit $fail |
|
|
|