| 1 |
clear_pdfdir |
| 2 |
|
| 3 |
set one [mkpdf one "foo"] |
| 4 |
set two [mkpdf two "bar"] |
| 5 |
set three [mkpdf three "foobar"] |
| 6 |
set four [mkpdf four "baz"] |
| 7 |
|
| 8 |
###################################################################### |
| 9 |
|
| 10 |
set test "files-with-matches" |
| 11 |
|
| 12 |
pdfgrep_expect --files-with-matches "foo" $one $two $three $four \ |
| 13 |
"$one |
| 14 |
$three" |
| 15 |
|
| 16 |
###################################################################### |
| 17 |
|
| 18 |
set test "files-without-match" |
| 19 |
|
| 20 |
pdfgrep_expect --files-without-match "foo" $one $two $three $four \ |
| 21 |
"$two |
| 22 |
$four" |
| 23 |
|
| 24 |
###################################################################### |
| 25 |
|
| 26 |
set test "recursive files-with-matches" |
| 27 |
|
| 28 |
pdfgrep_expect -l -r "foo" $pdfdir \ |
| 29 |
"(($one|$three)(\n)?){2}" |
| 30 |
|
| 31 |
###################################################################### |
| 32 |
|
| 33 |
set test "recursive files-without-match" |
| 34 |
|
| 35 |
pdfgrep_expect -L -r "foo" $pdfdir \ |
| 36 |
"(($two|$four)(\n)?){2}" |
| 37 |
|
| 38 |
###################################################################### |
| 39 |
|
| 40 |
set test "files-with-matches and -Z" |
| 41 |
|
| 42 |
pdfgrep_expect --null --files-with-matches "foo" $one $two $three $four \ |
| 43 |
"$one\0$three\0" |
| 44 |
|
| 45 |
###################################################################### |
| 46 |
|
| 47 |
set test "files-without-match and -Z" |
| 48 |
|
| 49 |
pdfgrep_expect -Z --files-without-match "foo" $one $two $three $four \ |
| 50 |
"$two\0$four\0" |
| 51 |
|
| 52 |
###################################################################### |
| 53 |
|
| 54 |
set test "files-with-matches and --with-filename" |
| 55 |
|
| 56 |
pdfgrep_expect --with-filename --files-with-matches "foo" $one $two $three $four \ |
| 57 |
"$one |
| 58 |
$three" |
| 59 |
|
| 60 |
###################################################################### |
| 61 |
|
| 62 |
set test "files-with-matches and --no-filename" |
| 63 |
|
| 64 |
pdfgrep_expect --no-filename --files-with-matches "foo" $one $two $three $four \ |
| 65 |
"$one |
| 66 |
$three" |
| 67 |
|
| 68 |
###################################################################### |
| 69 |
|
| 70 |
set test "files-without-match and --with-filename" |
| 71 |
|
| 72 |
pdfgrep_expect --with-filename --files-without-match "foo" $one $two $three $four \ |
| 73 |
"$two |
| 74 |
$four" |
| 75 |
|
| 76 |
###################################################################### |
| 77 |
|
| 78 |
set test "files-without-match and --no-filename" |
| 79 |
|
| 80 |
pdfgrep_expect --no-filename --files-without-match "foo" $one $two $three $four \ |
| 81 |
"$two |
| 82 |
$four" |
| 83 |
|
| 84 |
###################################################################### |
| 85 |
|
| 86 |
set test "files-with-matches and --page-number" |
| 87 |
|
| 88 |
pdfgrep_expect --page-number --files-with-matches "foo" $one $two $three $four \ |
| 89 |
"$one |
| 90 |
$three" |
| 91 |
|
| 92 |
###################################################################### |
| 93 |
|
| 94 |
set test "files-without-match and --page-number" |
| 95 |
|
| 96 |
pdfgrep_expect --page-number --files-without-match "foo" $one $two $three $four \ |
| 97 |
"$two |
| 98 |
$four" |
| 99 |
|
| 100 |
###################################################################### |
| 101 |
|
| 102 |
set test "files-with-matches and --page-count" |
| 103 |
|
| 104 |
pdfgrep_expect --page-count --files-with-matches "foo" $one $two $three $four \ |
| 105 |
"$one |
| 106 |
$three" |
| 107 |
|
| 108 |
###################################################################### |
| 109 |
|
| 110 |
set test "files-without-match and --page-count" |
| 111 |
|
| 112 |
pdfgrep_expect --page-count --files-without-match "foo" $one $two $three $four \ |
| 113 |
"$two |
| 114 |
$four" |
| 115 |
|
| 116 |
###################################################################### |
| 117 |
|
| 118 |
set test "files-with-matches and --only-matching" |
| 119 |
|
| 120 |
pdfgrep_expect --only-matching --files-with-matches "foo" $one $two $three $four \ |
| 121 |
"$one |
| 122 |
$three" |
| 123 |
|
| 124 |
###################################################################### |
| 125 |
|
| 126 |
set test "files-without-match and --only-matching" |
| 127 |
|
| 128 |
pdfgrep_expect --only-matching --files-without-match "foo" $one $two $three $four \ |
| 129 |
"$two |
| 130 |
$four" |
| 131 |
|
| 132 |
###################################################################### |
| 133 |
|
| 134 |
set test "files-with-matches and --context" |
| 135 |
|
| 136 |
pdfgrep_expect --context 3 --files-with-matches "foo" $one $two $three $four \ |
| 137 |
"$one |
| 138 |
$three" |
| 139 |
|
| 140 |
###################################################################### |
| 141 |
|
| 142 |
set test "files-without-match and --context" |
| 143 |
|
| 144 |
pdfgrep_expect --context 3 --files-without-match "foo" $one $two $three $four \ |
| 145 |
"$two |
| 146 |
$four" |
| 147 |
|
| 148 |
###################################################################### |
| 149 |
|
| 150 |
set test "files-with-matches and --count" |
| 151 |
|
| 152 |
pdfgrep_expect --count --files-with-matches "foo" $one $two $three $four \ |
| 153 |
"$one |
| 154 |
$three" |
| 155 |
|
| 156 |
###################################################################### |
| 157 |
|
| 158 |
set test "files-without-match and --count" |
| 159 |
|
| 160 |
pdfgrep_expect --count --files-without-match "foo" $one $two $three $four \ |
| 161 |
"$two |
| 162 |
$four" |
| 163 |
|
| 164 |
###################################################################### |
| 165 |
|
| 166 |
set test "files-with-matches and --quiet" |
| 167 |
|
| 168 |
pdfgrep_expect --quiet --files-with-matches "foo" $one $two $three $four "" |
| 169 |
expect_exit_status 0 |
| 170 |
|
| 171 |
###################################################################### |
| 172 |
|
| 173 |
set test "files-without-match and --quiet" |
| 174 |
|
| 175 |
pdfgrep_expect --quiet --files-without-match "foo" $one $two $three $four "" |
| 176 |
expect_exit_status 0 |
| 177 |
|
| 178 |
###################################################################### |
| 179 |
|
| 180 |
set test "files-with-matches (unsuccessful)" |
| 181 |
|
| 182 |
pdfgrep_expect --files-with-matches "barfoo" $one $two $three $four "" |
| 183 |
expect_exit_status 1 |
| 184 |
|
| 185 |
###################################################################### |
| 186 |
|
| 187 |
set test "files-without-match (unsuccessful)" |
| 188 |
|
| 189 |
pdfgrep_expect --files-without-match "barfoo" $one $two $three $four \ |
| 190 |
"$one |
| 191 |
$two |
| 192 |
$three |
| 193 |
$four" |
| 194 |
expect_exit_status 1 |