| 1 |
set test "warn-empty" |
| 2 |
|
| 3 |
clear_pdfdir |
| 4 |
set pdf [mkpdf empty {\rule{1cm}{1cm}}] |
| 5 |
|
| 6 |
pdfgrep_expect_error --warn-empty "foo" $pdf |
| 7 |
|
| 8 |
expect_exit_status 1 |
| 9 |
|
| 10 |
###################################################################### |
| 11 |
|
| 12 |
set test "hash as match-prefix-separator" |
| 13 |
|
| 14 |
clear_pdfdir |
| 15 |
set pdf [mkpdf foo {foobar}] |
| 16 |
|
| 17 |
pdfgrep_expect --match-prefix-separator=# -Hn foo $pdf \ |
| 18 |
"$pdf#1#foobar" |
| 19 |
|
| 20 |
###################################################################### |
| 21 |
|
| 22 |
set test "--null" |
| 23 |
|
| 24 |
clear_pdfdir |
| 25 |
set pdf1 [mkpdf one {foobar}] |
| 26 |
set pdf2 [mkpdf two {barfoo}] |
| 27 |
|
| 28 |
set line1_prefix $pdf1 |
| 29 |
set line2_prefix $pdf2 |
| 30 |
|
| 31 |
append line1_prefix "\0" |
| 32 |
append line1_prefix 1 |
| 33 |
|
| 34 |
append line2_prefix "\0" |
| 35 |
append line2_prefix 1 |
| 36 |
|
| 37 |
pdfgrep_expect --null -Hn foo $pdf1 $pdf2 \ |
| 38 |
"$line1_prefix:foobar |
| 39 |
$line2_prefix:barfoo" |
| 40 |
|
| 41 |
###################################################################### |
| 42 |
|
| 43 |
set test "only-matching" |
| 44 |
|
| 45 |
clear_pdfdir |
| 46 |
set pdf [mkpdf pdf {this is a long line}] |
| 47 |
|
| 48 |
pdfgrep_expect --only-matching long $pdf \ |
| 49 |
"long" |
| 50 |
|
| 51 |
###################################################################### |
| 52 |
|
| 53 |
set test "without arguments and no -r" |
| 54 |
|
| 55 |
set savedir [pwd] |
| 56 |
cd $pdfdir |
| 57 |
|
| 58 |
pdfgrep_expect foo \ |
| 59 |
"Usage.*" |
| 60 |
|
| 61 |
expect_exit_status 2 |
| 62 |
|
| 63 |
###################################################################### |
| 64 |
|
| 65 |
set test "without arguments and -r" |
| 66 |
|
| 67 |
pdfgrep_expect -r long \ |
| 68 |
"./pdf.pdf:this is a long line" |
| 69 |
|
| 70 |
###################################################################### |
| 71 |
|
| 72 |
set test "without arguments and -R" |
| 73 |
|
| 74 |
pdfgrep_expect -R long \ |
| 75 |
"./pdf.pdf:this is a long line" |
| 76 |
|
| 77 |
cd $savedir |
| 78 |
|
| 79 |
###################################################################### |
| 80 |
|
| 81 |
set test "text in MediaBox and not in CropBox" |
| 82 |
|
| 83 |
# a pdf can have multiple boundary boxes. By default, poppler-cpp uses the |
| 84 |
# CropBox which can be smaller as the guaranteed largest MediaBox. But pdfgrep |
| 85 |
# should also find text that's in in the MediaBox and not in the CropBox. |
| 86 |
|
| 87 |
clear_pdfdir |
| 88 |
set pdf [mkpdf pdf { |
| 89 |
\pdfpageattr{ |
| 90 |
% This is smaller than the default mediabox |
| 91 |
/CropBox [0 300 595.28 841.89] |
| 92 |
} |
| 93 |
test |
| 94 |
}] |
| 95 |
|
| 96 |
pdfgrep_expect ".*" $pdf \ |
| 97 |
"test" |
| 98 |
|
| 99 |
###################################################################### |
| 100 |
|
| 101 |
set test "Invalid locale setting" |
| 102 |
|
| 103 |
clear_pdfdir |
| 104 |
set pdf [mkpdf pdf foo] |
| 105 |
|
| 106 |
set env(LC_ALL) "invalid" |
| 107 |
|
| 108 |
pdfgrep_expect_error "foo" $pdf |
| 109 |
expect_exit_status 0 |
| 110 |
|
| 111 |
set env(LC_ALL) "C" |