passthrough.test: Use sed instead of tail.
[enscript.git] / src / tests / passthrough.test
1 #!/bin/sh
2 #
3 # Test pass through files.
4 #
5
6 . $srcdir/defs || exit 1
7
8 cat >test_input.ps <<EOF
9 %!
10 /Times-Roman findfont 30 scalefont setfont
11 100 100 moveto (Hi, I am a PostScript file) show
12 showpage
13 EOF
14
15 ### test_pass_through() {
16 $enscript -G2r --quiet --pass-through -p- test_input.ps \
17   | sed '1d' >$output
18
19 result=`sed '1d' test_input.ps | cmp - $output`
20
21 if test "X$result" != "X"; then
22   exit 1
23 fi
24
25 rm test_input.ps
26 ### }
27
28 echo 'D%!' | tr 'D' '\4' >test_input.ps
29 cat >>test_input.ps <<EOF
30 /Times-Roman findfont 30 scalefont setfont
31 100 100 moveto (Hi, I am a Windows damaged PostScript file) show
32 showpage
33 EOF
34
35 ### test_pass_through() {
36 $enscript -G2r --quiet --pass-through -p- test_input.ps \
37   | sed '1d' >$output
38
39 result=`sed '1d' test_input.ps | cmp - $output`
40
41 if test "X$result" != "X"; then
42   exit 1
43 fi
44
45 rm test_input.ps
46 ### }
47
48 echo '@E' | tr '@' '\33' >test_input.pcl
49 cat >>test_input.pcl <<EOF
50 This isn't really a PCL file but the magic is correct.
51 EOF
52
53 ### test_pass_through() {
54 $enscript -G2r --quiet --pass-through -p- test_input.pcl \
55   | sed '1d' >$output
56
57 result=`sed '1d' test_input.pcl | cmp - $output`
58
59 if test "X$result" != "X"; then
60   exit 1
61 fi
62
63 rm test_input.pcl
64 ### }
65
66 echo '@%' | tr '@' '\33' >test_input.pcl
67 cat >>test_input.pcl <<EOF
68 This isn't really a PCL file but the magic is correct.
69 EOF
70
71 ### test_pass_through() {
72 $enscript -G2r --quiet --pass-through -p- test_input.pcl \
73   | sed '1d' >$output
74
75 result=`sed '1d' test_input.pcl | cmp - $output`
76
77 if test "X$result" != "X"; then
78   exit 1
79 fi
80
81 rm test_input.pcl
82 ### }
83
84 rm $output