From e56e7291095bc9ba2368054601297c2cc65cdf90 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 10 Mar 2019 22:50:31 +0100 Subject: Add support for writing terse collections --- wscript | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'wscript') diff --git a/wscript b/wscript index b089e627..b757bee1 100644 --- a/wscript +++ b/wscript @@ -251,7 +251,8 @@ def build(bld): ('read_chunk_test', 'tests/read_chunk_test.c'), ('serd_test', 'tests/serd_test.c'), ('sink_test', 'tests/sink_test.c'), - ('statement_test', 'tests/statement_test.c')]: + ('statement_test', 'tests/statement_test.c'), + ('terse_write_test', 'tests/terse_write_test.c')]: bld(features = 'c cprogram', source = prog[1], use = 'libserd_profiled', @@ -535,7 +536,13 @@ def _file_lines_equal(patha, pathb, subst_from='', subst_to=''): return True -def test_suite(ctx, base_uri, testdir, report, isyntax, options=[]): +def test_suite(ctx, + base_uri, + testdir, + report, + isyntax, + options=[], + output_syntax=None): srcdir = ctx.path.abspath() mf = 'http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#' @@ -548,7 +555,7 @@ def test_suite(ctx, base_uri, testdir, report, isyntax, options=[]): def run_tests(test_class, tests, expected_return): thru_flags = [['-e'], ['-f'], ['-b'], ['-r', 'http://example.org/']] - osyntax = _test_output_syntax(test_class) + osyntax = output_syntax or _test_output_syntax(test_class) thru_options_iter = _option_combinations(thru_flags) tests_name = '%s.%s' % (testdir, test_class[test_class.find('#') + 1:]) with ctx.group(tests_name) as check: @@ -558,7 +565,9 @@ def test_suite(ctx, base_uri, testdir, report, isyntax, options=[]): action = os.path.join('tests', testdir, basename) rel_action = os.path.join(os.path.relpath(srcdir), action) uri = base_uri + os.path.basename(action) - command = [serdi, '-a'] + options + [rel_action, uri] + command = ([serdi, '-a', '-o', osyntax] + + options + + [rel_action, uri]) # Run strict test if expected_return == 0: @@ -612,7 +621,7 @@ def test(tst): import tempfile # Create test output directories - for i in ['bad', 'good', 'lax', + for i in ['bad', 'good', 'lax', 'terse', 'TurtleTests', 'NTriplesTests', 'NQuadsTests', 'TriGTests']: try: test_dir = os.path.join('tests', i) @@ -636,6 +645,7 @@ def test(tst): check(['./serd_test']) check(['./sink_test']) check(['./statement_test']) + check(['./terse_write_test']) def test_syntax_io(check, in_name, check_name, lang): in_path = 'tests/good/%s' % in_name @@ -716,6 +726,8 @@ def test(tst): test_suite(tst, serd_base + 'bad/', 'bad', None, 'Turtle') test_suite(tst, serd_base + 'lax/', 'lax', None, 'Turtle', ['-l']) test_suite(tst, serd_base + 'lax/', 'lax', None, 'Turtle') + test_suite(tst, serd_base + 'terse/', 'terse', None, 'Turtle', ['-t'], + output_syntax='Turtle') # Standard test suites with open('earl.ttl', 'w') as report: -- cgit v1.2.1