| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 import os | 3 import os |
| 4 import urllib | 4 import urllib |
| 5 import hashlib | 5 import hashlib |
| 6 | 6 |
| 7 doctmpl = """<!doctype html> | 7 doctmpl = """<!doctype html> |
| 8 <title>WebVTT cue data parser test %s</title> | 8 <title>WebVTT cue data parser test {testname}</title> |
| 9 <style>video { display:none }</style> | 9 <style>video {{ display:none }}</style> |
| 10 <script src=/../../../resources/testharness.js></script> | 10 <script src=../../../../../../../resources/testharness.js></script> |
| 11 <script src=/../../../resources/testharnessreport.js></script> | 11 <script src=../../../../../../../resources/testharnessreport.js></script> |
| 12 <script src=/core/standards/html-parsing/html5lib_harness/template.js></script> | |
| 13 <script src=/core/standards/html-parsing/html5lib_harness/common.js></script> | |
| 14 <script src=../common.js></script> | 12 <script src=../common.js></script> |
| 13 <p>WebVTT cue data parser test {testname}</p> |
| 15 <div id=log></div> | 14 <div id=log></div> |
| 16 <script> | 15 <script> |
| 17 runTests([ | 16 runTests([ |
| 18 %s | 17 {testlist} |
| 19 ]); | 18 ]); |
| 20 </script>""" | 19 </script>""" |
| 21 | 20 |
| 22 testobj = "{name:'%s', input:'%s', expected:'%s'}" | 21 testobj = "{name:'%s', input:'%s', expected:'%s'}" |
| 23 | 22 |
| 24 def appendtest(tests, input, expected): | 23 def appendtest(tests, input, expected): |
| 25 tests.append(testobj % (hashlib.sha1(input).hexdigest(), urllib.quote(input[
:-1]), urllib.quote(expected[:-1]))) | 24 tests.append(testobj % (hashlib.sha1(input).hexdigest(), urllib.quote(input[
:-1]), urllib.quote(expected[:-1]))) |
| 26 | 25 |
| 27 files = os.listdir('dat/') | 26 files = os.listdir('dat/') |
| 28 for file in files: | 27 for file in files: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 56 input = "" | 55 input = "" |
| 57 expected = "" | 56 expected = "" |
| 58 state = "" | 57 state = "" |
| 59 else: | 58 else: |
| 60 expected = expected + line | 59 expected = expected + line |
| 61 else: | 60 else: |
| 62 raise Exception("failed to parse file "+file+" line:"+line+" (state:
"+state+")") | 61 raise Exception("failed to parse file "+file+" line:"+line+" (state:
"+state+")") |
| 63 f.close() | 62 f.close() |
| 64 barename = file.replace(".dat", "") | 63 barename = file.replace(".dat", "") |
| 65 out = open('tests/'+barename+".html", "w") | 64 out = open('tests/'+barename+".html", "w") |
| 66 out.write(doctmpl % (barename, ",\n".join(tests))) | 65 out.write(doctmpl.format(testname=barename, testlist=",\n".join(tests))) |
| 67 out.close() | 66 out.close() |
| OLD | NEW |