Debian Codegraph @

testsuite/pdfgrep.tests/count.exp

raw
1 set test "count with one file"
2
3 clear_pdfdir
4 set count1 [mkpdf count1 {
5 foofoo\\
6 foo
7 \newpage
8 foo
9 }]
10 pdfgrep_expect --count foo $count1 \
11 "4"
12
13 expect_exit_status 0
14
15 ######################################################################
16
17 set test "warning for count and --page-number"
18
19 clear_pdfdir
20 set count1 [mkpdf count1 {
21 foofoo\\
22 foo
23 \newpage
24 foo
25 }]
26 pdfgrep_expect_with_err --count --page-number foo $count1 \
27 ".*pdfgrep: warning: .*
28 4"
29
30 expect_exit_status 0
31
32 ######################################################################
33
34 set test "count 0 with one file"
35
36 pdfgrep_expect --count not-there $count1 \
37 "0"
38
39 expect_exit_status 1
40
41 ######################################################################
42
43 set test "count with multiple files"
44
45 set count2 [mkpdf count2 {
46 foofoo\\
47 foo
48 \newpage
49 foo
50 }]
51
52 pdfgrep_expect --count foo $count1 $count2 \
53 "$count1:4
54 $count2:4"
55
56 expect_exit_status 0
57
58 ######################################################################
59
60 set test "count 0 with multiple files"
61
62 pdfgrep_expect --count not-there $count1 $count2 \
63 "$count1:0
64 $count2:0"
65
66 expect_exit_status 1
67
68 ######################################################################
69
70 set test "page count"
71
72 pdfgrep_expect --page-count foo $count1 \
73 "1:3
74 2:1"
75
76 ######################################################################
77
78 set test "page count 0"
79
80 pdfgrep_noerr --page-count not-there $count1
81 expect {
82 eof { pass $test }
83 -re ".+" { fail $test
84 expect eof
85 }
86 default { fail $test }
87 }
88
89 ######################################################################
90
91 set test "max-count 1"
92
93 pdfgrep_expect --max-count 1 foo $count1 \
94 "foofoo"
95
96 expect_exit_status 0
97
98 ######################################################################
99
100 set test "max-count 0"
101
102 pdfgrep_expect_error --max-count 0 foo $count1
103
104 expect_exit_status 2