]> git.lyx.org Git - lyx.git/blob - src/tex2lyx/test/runtests.py
Add very simple tex2lyx regression test suite.
[lyx.git] / src / tex2lyx / test / runtests.py
1 #! /usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 # file src/tex2lyx/test/runtests.py
5 # This file is part of LyX, the document processor.
6 # Licence details can be found in the file COPYING.
7
8 # author Georg Baum
9
10 # Full author contact details are available in file CREDITS
11
12 # This script reads a unicode symbol file and completes it in the given range
13
14 import os, string, sys
15
16
17 def usage(prog_name):
18     return "Usage: %s [<tex2lyx binary>]" % prog_name
19
20
21 def main(argv):
22     # Parse and manipulate the command line arguments.
23     sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '../../../lib/scripts'))
24     from lyxpreview_tools import error
25
26     if len(argv) == 1:
27         tex2lyx = './tex2lyx'
28     elif len(argv) == 2:
29         tex2lyx = argv[1]
30     else:
31         error(usage(argv[0]))
32
33     basedir = os.path.dirname(argv[0])
34
35     files = ['test.ltx', 'test-structure.tex', 'test-insets.tex', \
36              'box-color-size-space-align.tex', 'CJK.tex', \
37              'XeTeX-polyglossia.tex']
38
39     for f in files:
40         texfile = os.path.join(os.path.dirname(argv[0]), f)
41         cmd = '%s -roundtrip -f %s' % (tex2lyx, texfile)
42         if os.system(cmd) != 0:
43             error('Running `%s´ failed.' % cmd)
44
45
46 if __name__ == "__main__":
47     main(sys.argv)
48