3 # Copyright (c) 2005 Jonas Fonseca
6 test_description
='Test mailcap parsing and querying
8 This tests the parsing of various mailcap files, if they are
9 "prioritised" correctly, if the test are run correctly and
10 if querying returns the expected mailcap entry.
15 # Set PAGER to something recognisable since it gets appended as
16 # "|copiousoutput_handler" to entries with copiousoutput.
17 export PAGER
=copiousoutput_handler
19 ################################################################
20 # Parse a simple mailcap file
22 cat > mailcap-basic
<<EOF
24 text/html; elinks --force-html %s; needsterminal
25 text/enriched; richtext ; copiousoutput
26 text/*; view %s; needsterminal
27 application/postscript; ps2ascii %s ; copiousoutput
29 # Convert images to text using the netpbm tools
30 image/*; (anytopnm %s | pnmscale -xysize 200 150 | \
31 pnminvert | ppmtopgm | pgmtopbm | \
32 pbmtoascii -1x2 ) 2>&1 ; copiousoutput
36 --path "mailcap-basic" \
37 --format "block,program" \
40 --get "application/postscript" \
41 --get "application/foo" \
47 program: elinks --force-html %
53 type: application/postscript
61 'Parse simple mailcap file.' \
62 'cmp output expected' \
64 ################################################################
65 # Parse a two simple mailcap files; first one with tests
69 cat > mailcap-simple-with-test
<<EOF
70 application/postscript; gv %s ; test=test -e "DISPLAY" ;
71 image/*; xzgv %s ; test=test -e "DISPLAY";
75 --path "mailcap-simple-with-test:mailcap-simple" \
76 --format "block,program" \
78 --get "application/postscript" \
86 type: application/postscript
92 'Parse two simple mailcap files; first one with tests.' \
93 'cmp output expected' \