aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-10-20 23:59:38 +0200
committerDavid Robillard <d@drobilla.net>2019-10-21 01:14:59 +0200
commite45054876a08760fc3f223defd4297704b8eb170 (patch)
treee8bf1d9921c0e69d0ba88a789383a167acebdde7
parenta43adb1a2bebc3a0f19eccb1b97ca575e72590e1 (diff)
downloadserd-e45054876a08760fc3f223defd4297704b8eb170.tar.gz
serd-e45054876a08760fc3f223defd4297704b8eb170.tar.bz2
serd-e45054876a08760fc3f223defd4297704b8eb170.zip
Add test that NEWS file is normalised and round-trips to Turtle
-rw-r--r--wscript23
1 files changed, 23 insertions, 0 deletions
diff --git a/wscript b/wscript
index ca8bd013..6b89706c 100644
--- a/wscript
+++ b/wscript
@@ -3,6 +3,7 @@
import glob
import io
import os
+import sys
from waflib import Logs, Options
from waflib.extras import autowaf
@@ -444,6 +445,28 @@ def test(tst):
check([serdi, 'file://%s/tests/good/manifest.ttl' % srcdir],
stdout='/dev/full', name='Write error')
+ if sys.version_info.major >= 3:
+ from waflib.extras import autoship
+ try:
+ import rdflib
+ with tst.group('NEWS') as check:
+ news_path = os.path.join(srcdir, 'NEWS')
+ entries = autoship.read_news(top=srcdir)
+ autoship.write_news(entries, 'NEWS.norm')
+ check.file_equals(news_path, 'NEWS.norm')
+
+ meta_path = os.path.join(srcdir, 'serd.ttl')
+ autoship.write_news(entries, 'NEWS.ttl',
+ format='turtle', template=meta_path)
+
+ ttl_entries = autoship.read_news('NEWS.ttl',
+ top=srcdir, format='turtle')
+
+ autoship.write_news(ttl_entries, 'NEWS.round')
+ check.file_equals(news_path, 'NEWS.round')
+ except ImportError:
+ Logs.warn('Failed to import rdflib, not running NEWS tests')
+
# Serd-specific test suites
serd_base = 'http://drobilla.net/sw/serd/tests/'
test_suite(tst, serd_base + 'good/', 'good', None, 'Turtle')