summaryrefslogtreecommitdiff
path: root/xml2po/tests/test.py
blob: 082faf174969d23ecff847ad3b8fec3e659bcfe5 (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
#!/usr/bin/env python
import sys, os

SIMPLETESTS = ['deep-finals.xml', 'deep-nonfinals.xml', 'attribute-entities.xml', 'docbook.xml', 'utf8-original.xml', 'footnotes.xml' ]

OTHERTESTS = [ ('relnotes', 'test.sh') ]

if len(sys.argv) > 1:
    input = sys.argv[1]
    pot = input.replace(".xml", ".pot")
    po = input.replace(".xml", ".po")
    output = input.replace(".xml", ".xml.out")
    ret = os.system("../xml2po %s | sed 's/\"POT-Creation-Date: .*$/\"POT-Creation-Date: \\\\n\"/' | diff -u %s -" % (input, pot))
    if ret:
        print "Problem: extraction from '%s'" % (input)
    ret = os.system("../xml2po -p %s %s | diff -u %s -" % (po, input, output))
    if ret:
        print "Problem: merging translation into '%s'" % (input)
else:
    for t in SIMPLETESTS:
        if os.system("%s %s" % (sys.argv[0], t)):
            print "WARNING: Test %s failed." % (t)
    
    for t in OTHERTESTS:
        if os.system("cd %s && ./%s" % (t[0], t[1])):
            print "WARNING: Test %s failed." % (t[0])