summaryrefslogtreecommitdiff
path: root/Build/source/texk/dviout-util/dvispc.test
blob: 5af3aace3db1634c1d7a84e15c4f0583908e443d (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
#! /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/test.spc $testdir/test.spc \
  && diffoptCRLF=--strip-trailing-cr || echo


## EXE2SPECIAL

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

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

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

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


## EXE2TEXT + EXE2DVI

./dvispc -a $testdir/test.dvi xtesta.txt && \
  ./dvispc -x xtesta.txt xtestax.dvi && \
  cmp $testdir/test.dvi xtestax.dvi && echo || exit 4

./dvispc -a $testdir/test.dvi > x1testa.txt && \
  ./dvispc -x < x1testa.txt > x1testax.dvi && \
  cmp $testdir/test.dvi x1testax.dvi && echo || exit 5

# not working as expected only for test ??
#./dvispc -a $testdir/test.dvi | ./dvispc -x x2testax.dvi && \
#  cmp $testdir/test.dvi x2testax.dvi && echo || exit 5

./dvispc -a $testdir/test.dvi | ./dvispc -x > x2testax.dvi && \
  cmp $testdir/test.dvi x2testax.dvi && echo || exit 5


## EXE2INDEP

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

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

./dvispc && echo || exit 0

# the following tests include
#   * correction of dvipdfmx-style specials
#   * correction in reversed order which requires prior scanning
# so 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!)

./dvispc -c $testdir/test.dvi xtestout.dvi && \
  cmp $testdir/testout.dvi xtestout.dvi && echo || exit 8

./dvispc -c $testdir/test.dvi > x1testout.dvi && \
  cmp $testdir/testout.dvi x1testout.dvi && echo || exit 9

## invalid usage
#./dvispc -c < $testdir/test.dvi x2testout.dvi && \
#  cmp $testdir/testout.dvi x2testout.dvi && echo || exit 0

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


exit 0