summaryrefslogtreecommitdiff
path: root/Build/source/texk/dviout-util/dvispc.test
blob: 41ed78c8138fbda303dc49ed30c51ed9221f5cee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#! /bin/sh -vx
# $Id$
# Copyright (C) 2018 Japanese TeX Development Community <issue@texjp.org>
# You may freely use, modify and/or distribute this file.

testdir=$srcdir/tests

# pre-generated test results in the repository are stored in LF
# but the output might be written in CRLF on some platform.
# if 'diff --strip-trailing-cr' is available, exploit it.
# (useful for tests on win32 binaries run on MSYS shell)
diffoptCRLF=
diff --strip-trailing-cr $testdir/oldindep.spc $testdir/oldindep.spc \
  && diffoptCRLF=--strip-trailing-cr || echo


## EXE2SPECIAL

./dvispc -s $testdir/oldindep.dvi x0oldindep.spc && \
  diff $diffoptCRLF $testdir/oldindep.spc x0oldindep.spc && echo || exit 1

./dvispc -s $testdir/oldindep.dvi > x1oldindep.spc && \
  diff $diffoptCRLF $testdir/oldindep.spc x1oldindep.spc && echo || exit 2

## invalid usage
#./dvispc -s < $testdir/oldindep.dvi x2oldindep.spc && \
#  diff $testdir/oldindep.spc x2oldindep.spc && echo || exit 0

## stdin is a DVI, random access may not be supported, no test
#./dvispc -s < $testdir/oldindep.dvi > x3oldindep.spc && \
#  diff $testdir/oldindep.spc x3oldindep.spc && echo || exit 3


## EXE2TEXT + EXE2DVI

./dvispc -a $testdir/oldindep.dvi x0oldindepa.txt && \
  ./dvispc -x x0oldindepa.txt x0oldindepax.dvi && \
  cmp $testdir/oldindep.dvi x0oldindepax.dvi && echo || exit 4

./dvispc -a $testdir/oldindep.dvi > x1oldindepa.txt && \
  ./dvispc -x < x1oldindepa.txt > x1oldindepax.dvi && \
  cmp $testdir/oldindep.dvi x1oldindepax.dvi && echo || exit 5

# not working as expected only for test (redirect??)
#./dvispc -a $testdir/oldindep.dvi | ./dvispc -x x2oldindepax.dvi && \
#  cmp $testdir/oldindep.dvi x2oldindepax.dvi && echo || exit 6

./dvispc -a $testdir/oldindep.dvi | ./dvispc -x > x3oldindepax.dvi && \
  cmp $testdir/oldindep.dvi x3oldindepax.dvi && echo || exit 7


## EXE2INDEP

./dvispc -c $testdir/oldindep.dvi x0oldindepout.dvi && \
  cmp $testdir/oldindepout.dvi x0oldindepout.dvi && echo || exit 1

./dvispc -c $testdir/oldindep.dvi > x1oldindepout.dvi && \
  cmp $testdir/oldindepout.dvi x1oldindepout.dvi && echo || exit 2

## invalid usage
#./dvispc -c < $testdir/oldindep.dvi x2oldindepout.dvi && \
#  cmp $testdir/oldindepout.dvi x2oldindepout.dvi && echo || exit 0

## stdin is a DVI, random access may not be supported, no test
#./dvispc -c < $testdir/oldindep.dvi > x3oldindepout.dvi && \
#  cmp $testdir/oldindepout.dvi x3oldindepout.dvi && echo || exit 3

## check default is -c
./dvispc $testdir/oldindep.dvi x2oldindepout.dvi && \
  cmp $testdir/oldindepout.dvi x2oldindepout.dvi && echo || exit 4

## check default overwrite
# not working as expected only for test (redirect??)
#cp $testdir/oldindep.dvi x3write.dvi && \
#  ./dvispc x3write.dvi
#  cmp $testdir/oldindepout.dvi x3write.dvi && echo || exit 5

./dvispc && echo || exit 0

# the following tests will not pass for old version written by SHIMA.
# that version can be distinguished from the new version by
# exit code 1 for usage without argument. (the above line did it!)

# correction for tpicpn.dvi is needed but should be minimal
./dvispc $testdir/tpicpn.dvi x0tpicpnout.dvi && \
  cmp $testdir/tpicpnout.dvi x0tpicpnout.dvi && echo || exit 1

# correction for tpicsh.dvi is never needed, check no output
rm -f x0tpicshout.dvi
./dvispc $testdir/tpicsh.dvi x0tpicshout.dvi && \
  if test -f x0tpicshout.dvi; then exit 1; else echo; fi

## page independence in reverse order which requires prior scanning
./dvispc $testdir/reverse.dvi xreverseout.dvi && \
  cmp $testdir/reverseout.dvi xreverseout.dvi && echo || exit 1

# prior scanning should not mess up
./dvispc $testdir/first.dvi xfirstout.dvi && \
  cmp $testdir/firstout.dvi xfirstout.dvi && echo || exit 1

# prior scanning should not mess up (no correction)
rm -f xfirstpn.dvi
./dvispc $testdir/firstpn.dvi xfirstpn.dvi && \
  if test -f xfirstpn.dvi; then exit 1; else echo; fi

# ==== future work start ====

## page independence of annotation
#./dvispc $testdir/annot.dvi xannotout.dvi && \
#  cmp $testdir/annotout.dvi xannotout.dvi && echo || exit 2

## page independence of long (>255) specials (e.g. annotation)
## disabled because annotation is unsupported
#./dvispc $testdir/longspec.dvi xlongspecout.dvi && \
#  cmp $testdir/longspecout.dvi xlongspecout.dvi && echo || exit 3

## flatten nested anotation
#./dvispc $testdir/flatnest.dvi xflatnestout.dvi && \
#  cmp $testdir/flatnestout.dvi xflatnestout.dvi && echo || exit 4

# ==== future work end ====

## check -b backup works (old version did not!)
# not working as expected only for test (redirect??)
#cp $testdir/oldindep.dvi x4write.dvi && \
#  ./dvispc -b x4write.dvi
#  cmp $testdir/oldindepout.dvi x4write.dvi && echo || exit 1
#  cmp $testdir/oldindep.dvi x4write.dvi.bak && echo || exit 1

## without .dvi extension (old version missed for outfile!)
cp $testdir/oldindep.dvi x5write.dvi && \
  ./dvispc x5write x5writeout
  cmp $testdir/oldindepout.dvi x5writeout.dvi && echo || exit 2


exit 0