aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-07-05 21:01:12 +0200
committerDavid Robillard <d@drobilla.net>2020-06-21 18:12:04 +0200
commitaa65756284ba705a6d2e33a6fd1dca76a1602a88 (patch)
tree9ebb0138ef51c4209f2ee334407068c46c227506 /wscript
parenta0d356d595f3c4a016828df830161fbb17e967a9 (diff)
downloadserd-aa65756284ba705a6d2e33a6fd1dca76a1602a88.tar.gz
serd-aa65756284ba705a6d2e33a6fd1dca76a1602a88.tar.bz2
serd-aa65756284ba705a6d2e33a6fd1dca76a1602a88.zip
Simplify writer style options
Diffstat (limited to 'wscript')
-rw-r--r--wscript34
1 files changed, 28 insertions, 6 deletions
diff --git a/wscript b/wscript
index 98ac1175..dbeb420b 100644
--- a/wscript
+++ b/wscript
@@ -320,19 +320,41 @@ def earl_assertion(test, passed, asserter):
serdi = './serdi_static'
-def test_thru(check, base, path, check_path, flags, isyntax, osyntax, opts=[]):
+def test_osyntax_options(osyntax):
+ if osyntax.lower() == 'ntriples' or osyntax.lower() == 'nquads':
+ return [['-a']]
+ return []
+
+
+def flatten_options(opts):
+ return [o for sublist in opts for o in sublist]
+
+
+def test_thru(check,
+ base,
+ path,
+ check_path,
+ flags,
+ isyntax,
+ osyntax,
+ options=[]):
out_path = path + '.pass'
- out_cmd = [serdi] + opts + [f for sublist in flags for f in sublist] + [
+ opts = options + flatten_options(test_osyntax_options(osyntax))
+ flags = flatten_options(flags)
+ osyntax_opts = [f for sublist in
+ test_osyntax_options(osyntax) for f in sublist]
+ out_cmd = [serdi] + opts + flags + [
'-i', isyntax,
'-o', isyntax,
'-p', 'foo',
check.tst.src_path(path), base]
thru_path = path + '.thru'
- thru_cmd = [serdi] + opts + [
+ thru_cmd = [serdi] + opts + osyntax_opts + [
'-i', isyntax,
'-o', osyntax,
'-c', 'foo',
+ '-a',
out_path,
base]
@@ -410,7 +432,7 @@ def test_suite(ctx, base_uri, testdir, report, isyntax, options=[]):
asserter = 'http://drobilla.net/drobilla#me'
def run_tests(test_class, tests, expected_return):
- thru_flags = [['-e'], ['-f'], ['-b'], ['-r', 'http://example.org/']]
+ thru_flags = [['-e'], ['-b'], ['-r', 'http://example.org/']]
thru_options = []
for n in range(len(thru_flags) + 1):
thru_options += list(itertools.combinations(thru_flags, n))
@@ -425,7 +447,7 @@ 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] + options + ['-f', rel_action, uri]
+ command = [serdi, '-a'] + options + [rel_action, uri]
# Run strict test
if expected_return == 0:
@@ -579,4 +601,4 @@ def test(tst):
test_suite(tst, w3c_base + 'NQuadsTests/',
'NQuadsTests', report, 'NQuads')
test_suite(tst, w3c_base + 'TriGTests/',
- 'TriGTests', report, 'Trig', ['-a'])
+ 'TriGTests', report, 'Trig')