Skip to content

Commit

Permalink
update test suite and correct minor failures
Browse files Browse the repository at this point in the history
  • Loading branch information
wofr06 committed May 23, 2024
1 parent 0196b8c commit 872331c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
8 changes: 4 additions & 4 deletions lesspipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ isfinal () {
{ has_cmd pdftohtml && has_htmlprog && cmd=(istemp ispdf "$1"); } ||
{ has_cmd pdfinfo && cmd=(istemp pdfinfo "$1"); } ;;
postscript)
has_cmd ps2ascii && nodash ps2ascii "$1" ;;
has_cmd ps2ascii && nodash ps2ascii "$1" 2>/dev/null ;;
java-applet)
# filename needs to end in .class
has_cmd procyon && t=$t.class && cat "$1" > "$t" && cmd=(procyon "$t") ;;
Expand All @@ -525,10 +525,10 @@ isfinal () {
{ has_cmd libreoffice && cmd=(isoffice2 "$1"); } ;;
pptx)
{ has_cmd pptx2md && t2=$(nexttmp) &&
{ has_cmd mdcat && istemp "pptx2md --disable-image --disable-wmf \
{ { has_cmd mdcat && istemp "pptx2md --disable-image --disable-wmf \
-o $t2" "$1" && cmd=(mdcat "$t2"); } ||
{ has_cmd pandoc && istemp "pptx2md --disable-image --disable-wmf \
-o $t2" "$1" && cmd=(pandoc -f markdown -t plain "$t2"); }; } ||
-o $t2" "$1" && cmd=(pandoc -f markdown -t plain "$t2"); } }; } ||
{ can_do_office && cmd=(isoffice "$1" ppt); } ;;
xlsx|ods)
{ has_cmd xlscat && cmd=(istemp "xlscat -L -R all" "$1"); } ||
Expand Down Expand Up @@ -585,7 +585,7 @@ isfinal () {
has_cmd openssl && cmd=(istemp "openssl req -text -noout -in" "$1") ;;
pgp)
has_cmd gpg && cmd=(gpg --decrypt --quiet --no-tty --batch --yes "$1") ;;
plist)
bplist|plist)
{ has_cmd plistutil && cmd=(istemp "plistutil -i" "$1"); } ||
{ has_cmd plutil && cmd=(istemp "plutil -p" "$1"); } ;;
mp3)
Expand Down
22 changes: 9 additions & 13 deletions test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ sub usage {
$needed =~ s/ or /|/g;
$needed =~ s/ not /!/g;
$needed =~ s/ and /,/g;
$needed =~ s/html_converter/w3m|lynx|elinks|html2text/;
my @needed = split /\s*\|\s*/, $needed;
map {s/html_converter/w3m,lynx,elinks,html2text/} @needed;
if ($noaction) {
my $needed_str = $needed ? " ($needed)" : '';
print $verbose ? "$num $cmd $needed_str\n" : "$num $cmd\n";
Expand Down Expand Up @@ -293,18 +293,14 @@ sub comp {
= test
less tests/archive.tgz:test_7z:testok/a\|b.txt # (on the fly), needs 7zz|7zr|7za
= test
less $T/tests/test_iso # iso9660 contents, needs bsdtar
~ .* ISO.TXT
less tests/archive.tgz:test_iso # (on the fly), needs bsdtar
~ .* ISO.TXT
less $T/tests/test_iso # iso9660 contents, needs bsdtar|isoinfo
~ .* ISO.TXT|/ISO.TXT;1
less tests/archive.tgz:test_iso # (on the fly), needs bsdtar|isoinfo
~ .* ISO.TXT|/ISO.TXT;1
less $T/tests/test_iso:ISO.TXT # extract file from iso9660, needs bsdtar
= test
less tests/archive.tgz:test_iso:ISO.TXT # (on the fly), needs bsdtar
= test
less $T/tests/test_iso # iso9660 contents, needs isoinfo, not bsdtar
~ /ISO.TXT;1
less tests/archive.tgz:test_iso # (on the fly), needs isoinfo, not bsdtar
~ /ISO.TXT;1
less $T/tests/test_iso:/ISO.TXT\;1 # extract file from iso9660, needs isoinfo, not bsdtar
= test
less tests/archive.tgz:test_iso:/ISO.TXT\;1 # (on the fly), needs isoinfo, not bsdtar
Expand Down Expand Up @@ -370,11 +366,11 @@ sub comp {
less tests/filter.tgz:test_ppt:ms-powerpoint # ppt (old), catppt not always working, needs libreoffice,html_converter
~ .*1. test|\s*test
less tests/filter.tgz:test_xls # xls (old), needs in2csv|xls2csv|libreoffice,html_converter
= test
~ ^test$|^"test"$
less tests/filter.tgz:test_ooffice1 # openoffice1 (very old), needs sxw2txt|libreoffice
= test
less tests/filter.tgz:test_nroff # man pages etc (nroff), needs groff|mandoc
~ .* test \(1\)
~ .* Commands
less tests/filter.tgz:test_rtf # rtf, needs unrtf|libreoffice
~ test
less tests/filter.tgz:test_dvi # dvi, needs dvi2tty
Expand All @@ -388,7 +384,7 @@ sub comp {
less tests/filter.tgz:test_nc4 # netcdf, needs h5dump|ncdump
~ data:|\s*DATA .
less tests/filter.tgz:test_nc5 # hierarchical data format, needs h5dump|ncdump
~ d:|\s*DATA .
~ data:|\s*DATA .
less tests/filter.tgz:test_matlab # matlab git #18, needs matdump
~ r
less tests/filter.tgz:matlab.mat # matlab, not recognized by file, needs matdump
Expand Down Expand Up @@ -449,7 +445,7 @@ sub comp {
less $T/tests/test_zip:non-existent-file # nonexisting file in a zip archive git #1
~
LESS= less tests/dir.zip # do not colorize listing git #140
~ drwxrwxr-x 0 1000 1000 0 Dec 12 20:56 dir/
~ .* dir/
less $T/tests/test\ \;\'\"\[\(\{ok # file name with chars such as ", ' ...
= test
less tests/special.tgz:test\ \;\'\"\[\(\{ok # archive having a file with chars from [ ;"'] etc. in the name
Expand Down

0 comments on commit 872331c

Please sign in to comment.