aboutsummaryrefslogtreecommitdiffstats
path: root/test/meson.build
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-03-27 15:42:27 -0400
committerDavid Robillard <d@drobilla.net>2023-04-05 09:41:43 -0400
commite970e63146fb5d8de511104eba7aef5319e8653b (patch)
tree9f8e24335b84012ec0473e62301f37491c31cdb9 /test/meson.build
parent68c1a2e677775e489cff4beb38ef17c1efeae4e3 (diff)
downloadserd-e970e63146fb5d8de511104eba7aef5319e8653b.tar.gz
serd-e970e63146fb5d8de511104eba7aef5319e8653b.tar.bz2
serd-e970e63146fb5d8de511104eba7aef5319e8653b.zip
Add pretty-printing test suite
The earlier "test" was just hitting the code without actually checking the output. This new suite is a set of pretty-printed documents which serd must reproduce exactly to pass. This should make it easy to add cases in the future, since each case is just a document, as it should look.
Diffstat (limited to 'test/meson.build')
-rw-r--r--test/meson.build47
1 files changed, 35 insertions, 12 deletions
diff --git a/test/meson.build b/test/meson.build
index 847d5bef..6a4bbc55 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -1,6 +1,7 @@
# Copyright 2020-2023 David Robillard <d@drobilla.net>
# SPDX-License-Identifier: 0BSD OR ISC
+run_suite = find_program('run_suite.py')
run_test_suite = files('run_test_suite.py')
wrapper = meson.get_external_property('exe_wrapper', '')
@@ -64,13 +65,13 @@ endforeach
# System Tests #
################
-if not get_option('tools').disabled()
- if wrapper != ''
- script_args = ['--wrapper', wrapper, '--serdi', serdi.full_path()]
- else
- script_args = ['--serdi', serdi.full_path()]
- endif
+common_script_args = []
+if wrapper != ''
+ common_script_args += ['--wrapper', wrapper]
+endif
+if not get_option('tools').disabled()
+ script_args = common_script_args + ['--serdi', serdi]
serd_ttl = files('../serd.ttl')[0]
test('serd.ttl', serdi, args: [serd_ttl], suite: 'data')
@@ -158,18 +159,41 @@ if not get_option('tools').disabled()
test('write_error', files('test_write_error.py'),
args: script_args + [serd_ttl],
suite: 'io_errors')
+endif
- # RDF test suites
+###########################
+# Data-Driven Test Suites #
+###########################
+
+ns_serdtest = 'http://drobilla.net/sw/serd/test/'
+ns_w3 = 'http://www.w3.org/2013/'
+
+test_suites = {
+ 'pretty': [
+ files('pretty/manifest.ttl'), ns_serdtest + 'pretty/'
+ ],
+}
+
+if not get_option('tools').disabled()
+ script_args = common_script_args + ['--serdi', serdi]
+
+ foreach name, args : test_suites
+ test(
+ name, run_suite,
+ args: script_args + args,
+ suite: ['rdf'],
+ timeout: 240,
+ )
+ endforeach
## Serd-specific test suites
serd_suites = ['good', 'bad']
- serd_base = 'http://drobilla.net/sw/serd/test/'
### Run all suites with no special arguments
foreach name : serd_suites
manifest = files(name / 'manifest.ttl')
- base_uri = serd_base + name + '/'
+ base_uri = ns_serdtest + name + '/'
test(name, run_test_suite,
args: script_args + [manifest, base_uri],
suite: ['rdf', 'serd'],
@@ -178,7 +202,7 @@ if not get_option('tools').disabled()
### The lax suite is special because it is run twice...
lax_manifest = files('lax/manifest.ttl')
- lax_base_uri = serd_base + 'lax/'
+ lax_base_uri = ns_serdtest + 'lax/'
### ... once with strict parsing to test the hard errors
test('lax.strict', run_test_suite,
@@ -197,11 +221,10 @@ if not get_option('tools').disabled()
## Standard W3C test suites
w3c_suites = ['Turtle', 'NTriples', 'NQuads', 'TriG']
- w3c_base = 'http://www.w3.org/2013/'
foreach syntax : w3c_suites
manifest = files(syntax + 'Tests' / 'manifest.ttl')
- base_uri = w3c_base + syntax + 'Tests/'
+ base_uri = ns_w3 + syntax + 'Tests/'
args = ['--syntax', syntax, manifest, base_uri]
if syntax == 'TriG'