set test "Match line after double match" clear_pdfdir set pdf [mkpdf regex { foofoo\\ foo test }] pdfgrep_expect foo $pdf \ "foofoo foo test" set test "Match line after double match -- fixed string" pdfgrep_expect -F foo $pdf \ "foofoo foo test" set test "Match line after double match -- PCRE" set requires_pcre_support true pdfgrep_expect -P foo $pdf \ "foofoo foo test" ###################################################################### # This behaviour of repeating the same line over and over again is clearly not # optimal, but it's better than an infinite loop! set test "Empty pattern" set empty [mkpdf empty { abc }] set timeout 2 pdfgrep_expect "" $empty \ "abc" set test "Empty pattern -- fixed string" set timeout 2 pdfgrep_expect -F "" $empty \ "abc" set test "Empty pattern -- PCRE" set requires_pcre_support true set timeout 2 pdfgrep_expect -P "" $empty \ "abc" ###################################################################### set test "Case insensitive search" clear_pdfdir set pdf [mkpdf icase "FoObAr"] pdfgrep_expect -i "foobar" $pdf \ "FoObAr" set test "Case insensitive search -- fixed string" clear_pdfdir set pdf [mkpdf icase "FoObAr"] pdfgrep_expect -Fi "foobar" $pdf \ "FoObAr" set test "Case insensitive search -- PCRE" set requires_pcre_support true clear_pdfdir set pdf [mkpdf icase "FoObAr"] pdfgrep_expect -Pi "foobar" $pdf \ "FoObAr" ###################################################################### set test "Multiple fixed strings" clear_pdfdir set pdf [mkpdf lines { line one\\ line two\\ line three }] pdfgrep_expect -F "one\ntwo\nthree" $pdf \ "line one line two line three" ###################################################################### set test "Multiple fixed strings in wrong order" set multifixed [mkpdf multifixed { one two }] pdfgrep_expect -o -F "two\none" $multifixed \ "one two" ###################################################################### # Not sure if this should be the expected behavior. # # The feature to match multiline strings is often being requested, though set test "Multiline with PCRE" set requires_pcre_support true set multiline [mkpdf multiline { line one\\ line two }] pdfgrep_expect -P "one\nline" $multiline \ "line one line two" ###################################################################### set test "Empty page" clear_pdfdir set pdf [mkpdf empty { page1\\\\ still page 1 \newpage\mbox{}\newpage page2 }] pdfgrep_expect -n "^$" $pdf \ "2:" ###################################################################### set test "Empty page -- PCRE" set requires_pcre_support true pdfgrep_expect -P -n "^$" $pdf \ "2:" ###################################################################### set test "Page beginning is actually page beginning" pdfgrep_expect -n --only-match "p|^age" $pdf \ "1:p 1:p 3:p" ###################################################################### set test "Page beginning is actually page beginning -- PCRE" set requires_pcre_support true pdfgrep_expect -P -n --only-match "p|^age" $pdf \ "1:p 1:p 3:p" ###################################################################### set test "Invalid regex" pdfgrep_expect_error -r "(" . expect_exit_status 2 ###################################################################### set test "Invalid regex -- PCRE" pdfgrep_expect_error -Pr "(" . expect_exit_status 2 ###################################################################### clear_pdfdir set pdf [mkpdf empty { line1\\\\ line2 }] set test "^ only matches the beginning of a page" pdfgrep_expect "^line" $pdf "line1" ###################################################################### set test "^ only matches the beginning of a page -- PCRE" set requires_pcre_support true pdfgrep_expect -P "^line" $pdf "line1" ###################################################################### set test "\$ only matches the end of a page" pdfgrep_expect "line.\$" $pdf "line2" ###################################################################### set test "\$ only matches the end of a page -- PCRE" set requires_pcre_support true pdfgrep_expect -P "line.\$" $pdf "line2"