diff options
author | David Robillard <d@drobilla.net> | 2019-03-17 15:15:15 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-03-17 15:15:15 +0100 |
commit | 4e479c3679e79a72da50e9cfec4f4d7f039e3a04 (patch) | |
tree | 7860bdf02f6c6c7f4d28b25221ad2afd45842cbd | |
parent | aeb021c3c1aff5304e0bba506e15505e03b2a57c (diff) | |
download | serd-4e479c3679e79a72da50e9cfec4f4d7f039e3a04.tar.gz serd-4e479c3679e79a72da50e9cfec4f4d7f039e3a04.tar.bz2 serd-4e479c3679e79a72da50e9cfec4f4d7f039e3a04.zip |
Derive output syntax automatically from test class
-rw-r--r-- | wscript | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -305,7 +305,14 @@ def file_uri_to_path(uri): drive = os.path.splitdrive(path[1:])[0] return path if not drive else path[1:] -def test_suite(ctx, base_uri, testdir, report, isyntax, osyntax, options=''): +def _test_output_syntax(test_class): + if 'NTriples' in test_class or 'Turtle' in test_class: + return 'NTriples' + elif 'NQuads' in test_class or 'Trig' in test_class: + return 'NQuads' + raise Exception('Unknown test class <%s>' % test_class) + +def test_suite(ctx, base_uri, testdir, report, isyntax, options=''): import itertools srcdir = ctx.path.abspath() @@ -356,6 +363,7 @@ def test_suite(ctx, base_uri, testdir, report, isyntax, osyntax, options=''): thru_options += list(itertools.combinations(thru_flags, n)) thru_options_iter = itertools.cycle(thru_options) + osyntax = _test_output_syntax(test_class) quiet = not Options.options.verbose tests_name = '%s.%s' % (testdir, test_class[test_class.find('#') + 1:]) with autowaf.begin_tests(ctx, APPNAME, tests_name): @@ -484,8 +492,8 @@ def test(ctx): # Serd-specific test cases serd_base = 'http://drobilla.net/sw/serd/tests/' - test_suite(ctx, serd_base + 'good/', 'good', None, 'Turtle', 'NTriples') - test_suite(ctx, serd_base + 'bad/', 'bad', None, 'Turtle', 'NTriples') + test_suite(ctx, serd_base + 'good/', 'good', None, 'Turtle') + test_suite(ctx, serd_base + 'bad/', 'bad', None, 'Turtle') # Standard test suites with open('earl.ttl', 'w') as report: @@ -498,13 +506,13 @@ def test(ctx): w3c_base = 'http://www.w3.org/2013/' test_suite(ctx, w3c_base + 'TurtleTests/', - 'TurtleTests', report, 'Turtle', 'NTriples') + 'TurtleTests', report, 'Turtle') test_suite(ctx, w3c_base + 'NTriplesTests/', - 'NTriplesTests', report, 'NTriples', 'NTriples') + 'NTriplesTests', report, 'NTriples') test_suite(ctx, w3c_base + 'NQuadsTests/', - 'NQuadsTests', report, 'NQuads', 'NQuads') + 'NQuadsTests', report, 'NQuads') test_suite(ctx, w3c_base + 'TriGTests/', - 'TriGTests', report, 'TriG', 'NQuads', '-a') + 'TriGTests', report, 'TriG', '-a') autowaf.post_test(ctx, APPNAME) |