Debian Codegraph @

testsuite/pdfgrep.tests/recursive.exp

raw
1 clear_pdfdir
2
3 mkpdf abc "foobar"
4 mkpdf acb "foobar"
5 mkpdf bca "foobar"
6 mkpdf bac "foobar"
7
8 file mkdir $pdfdir/subdir
9 file rename $pdfdir/acb.pdf $pdfdir/subdir/acb.pdf
10 # does not end with .pdf
11 file rename $pdfdir/bac.pdf $pdfdir/bac.notpdf
12
13 file link $pdfdir/link.pdf abc.pdf
14
15 # We should no have the following directory structure:
16 #
17 # - abc.pdf
18 # - bca.pdf
19 # - bac.notpdf
20 # - foobar/
21 # `- acb.pdf
22
23 set abc_match "$pdfdir/abc.pdf:foobar"
24 set acb_match "$pdfdir/subdir/acb.pdf:foobar"
25 set bca_match "$pdfdir/bca.pdf:foobar"
26 set bac_match "$pdfdir/bac.notpdf:foobar"
27 set link_match "$pdfdir/link.pdf:foobar"
28
29 ######################################################################
30
31 set test "recursive without include/exclude"
32
33 # Important: The order of the files is not specified
34
35 pdfgrep_expect -r "foobar" $pdfdir \
36 "(($abc_match|$acb_match|$bca_match)(\n)?){3}"
37
38 ######################################################################
39
40 set test "recursive with include"
41
42 pdfgrep_expect -r --include "b*pdf" "foobar" $pdfdir \
43 "(($bca_match|$bac_match)(\n)?){2}"
44
45 ######################################################################
46
47 set test "recursive with exclude"
48
49 pdfgrep_expect -r --exclude "b*" "foobar" $pdfdir \
50 "(($abc_match|$acb_match)(\n)?){2}"
51
52 ######################################################################
53
54 set test "recursive with include/exclude"
55
56 pdfgrep_expect -r --exclude "a*" --include "*.notpdf" "foobar" $pdfdir \
57 "$bac_match"
58
59 ######################################################################
60
61 set test "dereference-recursive"
62
63 pdfgrep_expect -R "foobar" $pdfdir \
64 "(($abc_match|$acb_match|$bca_match|$link_match)(\n)?){4}"
65
66 ######################################################################
67
68 set test "recursive includes uppercase PDF"
69
70 # Important: The order of the files is not specified
71
72 file rename $pdfdir/abc.pdf $pdfdir/abc.PDF
73
74 pdfgrep_expect -r "foobar" $pdfdir \
75 "(($pdfdir/abc.PDF:foobar|$acb_match|$bca_match)(\n)?){3}"