Debian Codegraph @

testsuite/pdfgrep.tests/color.exp

raw
1 set test "Print error if the argument for --color is invalid"
2
3 pdfgrep --color=INVALID -r pattern
4
5 # The error message should contain the wrong argument and the expected ones
6 expect {
7 -re "^pdfgrep: .*((INVALID|auto|never|always).*){4}.*$" { ppass $test }
8 default { pfail $test }
9 }
10
11 expect eof
12 expect_exit_status 2
13
14
15 ######################################################################
16
17 set test "GREP_COLORS default values"
18
19 clear_pdfdir
20 set pdf [mkpdf pdf {one two three}]
21
22 set env(GREP_COLORS) ""
23
24 set fn "\33\\\[35m\33\\\[K"
25 set ln "\33\\\[32m\33\\\[K"
26 set se "\33\\\[36m\33\\\[K"
27 set ms "\33\\\[01;31m\33\\\[K"
28 set end "\33\\\[m\33\\\[K"
29
30 pdfgrep_expect --color=always --with-filename --page-number two $pdf \
31 "$fn$pdf$end$se:$end[set ln]1$end$se:[set end]one [set ms]two$end three"
32
33 ######################################################################
34
35 set test "GREP_COLORS with custom values"
36
37 clear_pdfdir
38 set pdf [mkpdf pdf {one two three}]
39
40 set env(GREP_COLORS) "fn=32:ln=36:se=35:ms=01;34"
41
42 set fn "\33\\\[32m\33\\\[K"
43 set ln "\33\\\[36m\33\\\[K"
44 set se "\33\\\[35m\33\\\[K"
45 set ms "\33\\\[01;34m\33\\\[K"
46 set end "\33\\\[m\33\\\[K"
47
48 pdfgrep_expect --color=always --with-filename --page-number two $pdf \
49 "$fn$pdf$end$se:$end[set ln]1$end$se:[set end]one [set ms]two$end three"