summaryrefslogtreecommitdiff
path: root/util/texi2dvi.test
blob: 2f3f0751698ab98217be3b23aa966e25034a80d5 (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
#! /bin/sh
# Copyright (C) 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of GNU Texinfo.
#
# GNU Texinfo is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
#
# GNU Texinfo is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

required='tex'

. ./defs || exit 1

set -e

# one_run ARGS -- FILES
# ---------------------
# Run texi2dvi with ARGS, expect the FILES to be left.  Remove them.
one_run ()
{
  # Testing the local build mode.
  # Use @foo to check that -t works properly.
  echo "@foo" | create_input_texi
  TEXI2DVI_pass $(optionset_get 1 "$@") \
     -t '@macro foo' \
     -t 'Foo'        \
     -t '@end macro' \
     input.texi
  # There should only be the expected FILES and the input file.
  assert_and_remove_files $(optionset_get 2 "$@") input.texi
}

one_run --batch \
   -- \
   input.aux input.cp input.dvi input.fn input.ky input.log \
   input.pg input.tp input.vr


one_run --batch -o output.dvi \
   -- \
   input.aux input.cp input.fn input.ky input.log \
   input.pg input.tp input.vr output.dvi


# Testing the clean build mode.
for mode in --clean --build=clean
do
  # There should only be the DVI and the TEXI file.
  one_run $mode --batch -- input.dvi

  # There should only be the DVI and the TEXI file.
  one_run $mode --batch -o output.dvi -- output.dvi
done


# Testing the tidy build mode.
one_run --build=tidy --batch -o output.dvi \
   -- \
   output.dvi output.t2d


# mostly-clean should remove auxiliary files, but not the expected
# output.
touch output.dvi
one_run --build=tidy --batch -o output.dvi --mostly-clean \
   -- \
   output.dvi


# There should only be the DVI and the TEXI file.
create_input_texi </dev/null
cp input.texi input2.texi
one_run --clean --batch input.texi input2.texi \
   -- \
   input2.dvi input2.texi input.dvi