aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-12-24 22:43:25 +0000
committerDavid Robillard <d@drobilla.net>2013-12-24 22:43:25 +0000
commit2ecbc85f122fcf850f7254e54653255e999cd119 (patch)
tree032f8eeb99411f3686f0e3a41d00788c0300ab39 /wscript
parenta38f60f807f7f00a9f88b2d59e3c3e776f41de8a (diff)
downloadserd-2ecbc85f122fcf850f7254e54653255e999cd119.tar.gz
serd-2ecbc85f122fcf850f7254e54653255e999cd119.tar.bz2
serd-2ecbc85f122fcf850f7254e54653255e999cd119.zip
Update to latest Turtle test suite.
Support UTF-8 in blank node names. Support idiotic SPARQL escaping in local names. git-svn-id: http://svn.drobilla.net/serd/trunk@452 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'wscript')
-rw-r--r--wscript28
1 files changed, 14 insertions, 14 deletions
diff --git a/wscript b/wscript
index 7277e336..f5f02439 100644
--- a/wscript
+++ b/wscript
@@ -307,7 +307,7 @@ def test_thru(ctx, base, path, check_filename, flags):
return False
-def test_manifest(ctx, srcdir, testdir, report, test_base, parse_base):
+def test_manifest(ctx, srcdir, testdir, report, base_uri):
import rdflib
import urlparse
@@ -319,7 +319,7 @@ def test_manifest(ctx, srcdir, testdir, report, test_base, parse_base):
model = rdflib.ConjunctiveGraph()
model.parse(os.path.join(srcdir, 'tests', testdir, 'manifest.ttl'),
- rdflib.URIRef(test_base + 'manifest.ttl'),
+ rdflib.URIRef(base_uri + 'manifest.ttl'),
format='n3')
is_drobilla = (os.getenv('USER') == 'drobilla')
@@ -329,14 +329,14 @@ def test_manifest(ctx, srcdir, testdir, report, test_base, parse_base):
output = os.path.join('tests', testdir, action_node + '.out')
action = os.path.join(srcdir, 'tests', testdir, action_node)
rel = os.path.relpath(action, os.path.join(srcdir, 'tests', testdir))
- command = 'serdi_static -f "%s" "%s" > %s' % (action, parse_base + rel, output)
+ command = 'serdi_static -f "%s" "%s" > %s' % (action, base_uri + rel, output)
return autowaf.run_test(ctx, APPNAME, command, expected_return, name=name)
for i in sorted(model.triples([None, rdf.type, rdft.TestTurtlePositiveSyntax])):
test = i[0]
name = model.value(test, mf.name, None)
- action_node = model.value(test, mf.action, None)[len(test_base):]
+ action_node = model.value(test, mf.action, None)[len(base_uri):]
passed = run_test(action_node, 0)
report.write(earl_assertion(test, passed, asserter))
@@ -344,7 +344,7 @@ def test_manifest(ctx, srcdir, testdir, report, test_base, parse_base):
for i in sorted(model.triples([None, rdf.type, rdft.TestTurtleNegativeSyntax])):
test = i[0]
name = model.value(test, mf.name, None)
- action_node = model.value(test, mf.action, None)[len(test_base):]
+ action_node = model.value(test, mf.action, None)[len(base_uri):]
passed = run_test(action_node, 1)
report.write(earl_assertion(test, passed, asserter))
@@ -352,7 +352,7 @@ def test_manifest(ctx, srcdir, testdir, report, test_base, parse_base):
for i in sorted(model.triples([None, rdf.type, rdft.TestTurtleNegativeEval])):
test = i[0]
name = model.value(test, mf.name, None)
- action_node = model.value(test, mf.action, None)[len(test_base):]
+ action_node = model.value(test, mf.action, None)[len(base_uri):]
passed = run_test(action_node, 1)
report.write(earl_assertion(test, passed, asserter))
@@ -360,8 +360,8 @@ def test_manifest(ctx, srcdir, testdir, report, test_base, parse_base):
for i in sorted(model.triples([None, rdf.type, rdft.TestTurtleEval])):
test = i[0]
name = model.value(test, mf.name, None)
- action_node = model.value(test, mf.action, None)[len(test_base):]
- result_node = model.value(test, mf.result, None)[len(test_base):]
+ action_node = model.value(test, mf.action, None)[len(base_uri):]
+ result_node = model.value(test, mf.result, None)[len(base_uri):]
passed = run_test(action_node, 0)
@@ -379,13 +379,13 @@ def test_manifest(ctx, srcdir, testdir, report, test_base, parse_base):
else:
Logs.pprint('GREEN', '** Pass %s' % output)
- test_thru(ctx, parse_base + action_node, action, result, "")
+ test_thru(ctx, base_uri + action_node, action, result, "")
report.write(earl_assertion(test, passed, asserter))
def test(ctx):
blddir = autowaf.build_dir(APPNAME, 'tests')
- for i in ['', 'bad', 'good', 'new', 'tests-ttl', 'extra']:
+ for i in ['', 'bad', 'good', 'new', 'TurtleTests', 'extra']:
try:
os.makedirs(os.path.join(blddir, i))
except:
@@ -508,6 +508,8 @@ def test(ctx):
check = os.path.join(srcdir, path.replace('.ttl', '.nt'))
test_thru(ctx, test_base(test), path, check, flags)
+
+ # New manifest-driven tests
try:
report = open('earl.ttl', 'w')
report.write('''@prefix earl: <http://www.w3.org/ns/earl#> .
@@ -517,10 +519,8 @@ def test(ctx):
for line in serd_ttl:
report.write(line)
serd_ttl.close()
- rdf_turtle = 'https://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/'
- test_manifest(ctx, srcdir, 'tests-ttl', report,
- rdf_turtle + 'tests-ttl/', 'http://example/base/')
-
+ turtle_tests = 'http://www.w3.org/2013/TurtleTests/'
+ test_manifest(ctx, srcdir, 'TurtleTests', report, turtle_tests)
report.close()
except: