]> git.lyx.org Git - lyx.git/blob - src/tex2lyx/test/runtests.py
Merge branch 'master' of git.lyx.org:lyx
[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> [<script dir>]]" % prog_name
19
20
21 def main(argv):
22     # Parse and manipulate the command line arguments.
23     if len(argv) == 3:
24         sys.path.append(os.path.join(sys.argv[2]))
25     else:
26         sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '../../../lib/scripts'))
27
28     from lyxpreview_tools import error
29
30     if len(argv) < 2:
31         tex2lyx = './tex2lyx'
32     elif len(argv) <= 3:
33         tex2lyx = argv[1]
34     else:
35         error(usage(argv[0]))
36
37     basedir = os.path.dirname(argv[0])
38
39     files = ['test.ltx', 'test-structure.tex', 'test-insets.tex', \
40              'box-color-size-space-align.tex', 'CJK.tex', \
41              'XeTeX-polyglossia.tex']
42
43     errors = []
44     for f in files:
45         texfile = os.path.join(os.path.dirname(argv[0]), f)
46         cmd = '%s -roundtrip -f %s' % (tex2lyx, texfile)
47         if os.system(cmd) != 0:
48             errors.append(f)
49
50     if len(errors) > 0:
51         error('Converting the following files failed: %s' % ', '.join(errors))
52
53 if __name__ == "__main__":
54     main(sys.argv)
55