clear_pdfdir mkpdf abc "foobar" mkpdf acb "foobar" mkpdf bca "foobar" mkpdf bac "foobar" file mkdir $pdfdir/subdir file rename $pdfdir/acb.pdf $pdfdir/subdir/acb.pdf # does not end with .pdf file rename $pdfdir/bac.pdf $pdfdir/bac.notpdf file link $pdfdir/link.pdf abc.pdf # We should no have the following directory structure: # # - abc.pdf # - bca.pdf # - bac.notpdf # - foobar/ # `- acb.pdf set abc_match "$pdfdir/abc.pdf:foobar" set acb_match "$pdfdir/subdir/acb.pdf:foobar" set bca_match "$pdfdir/bca.pdf:foobar" set bac_match "$pdfdir/bac.notpdf:foobar" set link_match "$pdfdir/link.pdf:foobar" ###################################################################### set test "recursive without include/exclude" # Important: The order of the files is not specified pdfgrep_expect -r "foobar" $pdfdir \ "(($abc_match|$acb_match|$bca_match)(\n)?){3}" ###################################################################### set test "recursive with include" pdfgrep_expect -r --include "b*pdf" "foobar" $pdfdir \ "(($bca_match|$bac_match)(\n)?){2}" ###################################################################### set test "recursive with exclude" pdfgrep_expect -r --exclude "b*" "foobar" $pdfdir \ "(($abc_match|$acb_match)(\n)?){2}" ###################################################################### set test "recursive with include/exclude" pdfgrep_expect -r --exclude "a*" --include "*.notpdf" "foobar" $pdfdir \ "$bac_match" ###################################################################### set test "dereference-recursive" pdfgrep_expect -R "foobar" $pdfdir \ "(($abc_match|$acb_match|$bca_match|$link_match)(\n)?){4}" ###################################################################### set test "recursive includes uppercase PDF" # Important: The order of the files is not specified file rename $pdfdir/abc.pdf $pdfdir/abc.PDF pdfgrep_expect -r "foobar" $pdfdir \ "(($pdfdir/abc.PDF:foobar|$acb_match|$bca_match)(\n)?){3}"