aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-03-29 19:59:47 -0400
committerDavid Robillard <d@drobilla.net>2023-04-05 09:45:15 -0400
commitdd777c54b7585823be1f977e9dd887a5110a74f3 (patch)
tree0af28e331aba4e1d15719519ac9834a0b59817b7
parent978467d01da0c487348e2a0118c1aed196070230 (diff)
downloadserd-dd777c54b7585823be1f977e9dd887a5110a74f3.tar.gz
serd-dd777c54b7585823be1f977e9dd887a5110a74f3.tar.bz2
serd-dd777c54b7585823be1f977e9dd887a5110a74f3.zip
Test URI and blank node manipulation features separately
-rw-r--r--.reuse/dep52
-rw-r--r--test/good/qualify-in.ttl3
-rw-r--r--test/good/qualify-out.ttl5
-rw-r--r--test/meson.build26
-rw-r--r--test/prefix/README.md4
-rw-r--r--test/prefix/manifest.ttl20
-rw-r--r--test/prefix/remove-prefixes.nt4
-rw-r--r--test/prefix/remove-prefixes.ttl7
-rw-r--r--test/qualify/README.md4
-rw-r--r--test/qualify/manifest.ttl20
-rw-r--r--test/qualify/qualify-in.ttl10
-rw-r--r--test/qualify/qualify-out.ttl10
-rw-r--r--test/root/README.md5
-rw-r--r--test/root/manifest.ttl27
-rw-r--r--test/root/root-inside-base-in.ttl23
-rw-r--r--test/root/root-inside-base-out.ttl23
-rw-r--r--test/root/root-outside-base-in.ttl23
-rw-r--r--test/root/root-outside-base-out.ttl23
18 files changed, 228 insertions, 11 deletions
diff --git a/.reuse/dep5 b/.reuse/dep5
index e19c6fed..e404aabb 100644
--- a/.reuse/dep5
+++ b/.reuse/dep5
@@ -8,7 +8,7 @@ Copyright: 2010 World Wide Web Consortium, (MIT, ERCIM, Keio, Beihang) and other
Comment: Standard test suites from the W3C (only required for testing)
License: BSD-3-Clause
-Files: test/bad/* test/good/* test/lax/* test/pretty/*
+Files: test/bad/* test/good/* test/lax/* test/qualify/* test/root/* test/prefix/* test/pretty/*
Copyright: 2011-2023 David Robillard <d@drobilla.net>
Comment: Extra tests for serd (potential contributions to the W3C suites)
License: BSD-3-Clause OR ISC
diff --git a/test/good/qualify-in.ttl b/test/good/qualify-in.ttl
deleted file mode 100644
index d938b7bd..00000000
--- a/test/good/qualify-in.ttl
+++ /dev/null
@@ -1,3 +0,0 @@
-@prefix eg: <http://example.org/> .
-
-<http://example.org/s> <http://example.org/p> <http://example.org/o> .
diff --git a/test/good/qualify-out.ttl b/test/good/qualify-out.ttl
deleted file mode 100644
index 97f67a53..00000000
--- a/test/good/qualify-out.ttl
+++ /dev/null
@@ -1,5 +0,0 @@
-@prefix eg: <http://example.org/> .
-
-eg:s
- eg:p eg:o .
-
diff --git a/test/meson.build b/test/meson.build
index 1d126f61..bd027d26 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -195,8 +195,19 @@ ns_serdtest = 'http://drobilla.net/sw/serd/test/'
ns_w3 = 'http://www.w3.org/2013/'
test_suites = {
+ 'prefix.remove': [
+ files('prefix/manifest.ttl'), ns_serdtest + 'prefix/',
+ '--', '-c', 'test',
+ ],
'pretty': [
- files('pretty/manifest.ttl'), ns_serdtest + 'pretty/'
+ files('pretty/manifest.ttl'), ns_serdtest + 'pretty/',
+ ],
+ 'qualify': [
+ files('qualify/manifest.ttl'), ns_serdtest + 'qualify/',
+ ],
+ 'root': [
+ files('root/manifest.ttl'), ns_serdtest + 'root/',
+ '--', '-r', 'http://example.org/top/root/',
],
}
@@ -226,6 +237,17 @@ if not get_option('tools').disabled()
timeout: 240)
endforeach
+ test('good.bulk', run_test_suite,
+ args: script_args + [
+ files('good/manifest.ttl'),
+ ns_serdtest + 'good/',
+ '--',
+ '-b'
+ ],
+ is_parallel: false,
+ suite: ['rdf', 'serd'],
+ timeout: 240)
+
### The lax suite is special because it is run twice...
lax_manifest = files('lax/manifest.ttl')
lax_base_uri = ns_serdtest + 'lax/'
@@ -252,7 +274,7 @@ if not get_option('tools').disabled()
manifest = files(syntax + 'Tests' / 'manifest.ttl')
base_uri = ns_w3 + syntax + 'Tests/'
- args = ['--syntax', syntax, manifest, base_uri]
+ args = [manifest, base_uri]
if syntax == 'TriG'
args += ['--', '-a']
endif
diff --git a/test/prefix/README.md b/test/prefix/README.md
new file mode 100644
index 00000000..56a07244
--- /dev/null
+++ b/test/prefix/README.md
@@ -0,0 +1,4 @@
+Prefix Test Suite
+=================
+
+This small suite tests adding/chopping prefixes to/from blank node labels.
diff --git a/test/prefix/manifest.ttl b/test/prefix/manifest.ttl
new file mode 100644
index 00000000..12a0f9ca
--- /dev/null
+++ b/test/prefix/manifest.ttl
@@ -0,0 +1,20 @@
+@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix rdft: <http://www.w3.org/ns/rdftest#> .
+@prefix serd: <http://drobilla.net/ns/serd#> .
+
+<>
+ a mf:Manifest ;
+ rdfs:comment "Serd blank node prefixing test suite" ;
+ mf:entries (
+ <#remove-prefixes>
+ ) .
+
+<#remove-prefixes>
+ a rdft:TestTurtleEval ;
+ mf:action <remove-prefixes.ttl> ;
+ mf:name "remove-prefixes" ;
+ mf:result <remove-prefixes.nt> .
+
+rdft:Test
+ rdfs:subClassOf mf:ManifestEntry .
diff --git a/test/prefix/remove-prefixes.nt b/test/prefix/remove-prefixes.nt
new file mode 100644
index 00000000..26ac46ee
--- /dev/null
+++ b/test/prefix/remove-prefixes.nt
@@ -0,0 +1,4 @@
+_:s1 <http://example.org/p1> _:o1 .
+_:s1 <http://example.org/p2> _:o3 .
+_:s1 <http://example.org/p2> _:o4 .
+_:b0 <http://example.org/p3> _:b1 .
diff --git a/test/prefix/remove-prefixes.ttl b/test/prefix/remove-prefixes.ttl
new file mode 100644
index 00000000..f3002a59
--- /dev/null
+++ b/test/prefix/remove-prefixes.ttl
@@ -0,0 +1,7 @@
+_:tests1
+ <http://example.org/p1> _:testo1 ;
+ <http://example.org/p2> _:testo3 ,
+ _:testo4 .
+
+_:testb0
+ <http://example.org/p3> _:testb1 .
diff --git a/test/qualify/README.md b/test/qualify/README.md
new file mode 100644
index 00000000..c345f242
--- /dev/null
+++ b/test/qualify/README.md
@@ -0,0 +1,4 @@
+Qualify Test Suite
+==================
+
+This small suite tests qualifying full URIs into shortened forms.
diff --git a/test/qualify/manifest.ttl b/test/qualify/manifest.ttl
new file mode 100644
index 00000000..0a2fb698
--- /dev/null
+++ b/test/qualify/manifest.ttl
@@ -0,0 +1,20 @@
+@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix rdft: <http://www.w3.org/ns/rdftest#> .
+@prefix serd: <http://drobilla.net/ns/serd#> .
+
+<>
+ a mf:Manifest ;
+ rdfs:comment "Serd URI qualification test suite" ;
+ mf:entries (
+ <#qualify>
+ ) .
+
+<#qualify>
+ a rdft:TestTurtleEval ;
+ mf:action <qualify-in.ttl> ;
+ mf:name "qualify" ;
+ mf:result <qualify-out.ttl> .
+
+rdft:Test
+ rdfs:subClassOf mf:ManifestEntry .
diff --git a/test/qualify/qualify-in.ttl b/test/qualify/qualify-in.ttl
new file mode 100644
index 00000000..04afc07f
--- /dev/null
+++ b/test/qualify/qualify-in.ttl
@@ -0,0 +1,10 @@
+@prefix eg: <http://example.org/> .
+
+<http://example.org/s>
+ <http://example.org/p> <http://example.org/o> .
+
+<http://example.org/a-subject>
+ <http://example.org/a-predicate> <http://example.org/a-object> .
+
+<http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>
+ <http://www.w3.org/2000/01/rdf-schema#label> "nil" .
diff --git a/test/qualify/qualify-out.ttl b/test/qualify/qualify-out.ttl
new file mode 100644
index 00000000..f4dd15d4
--- /dev/null
+++ b/test/qualify/qualify-out.ttl
@@ -0,0 +1,10 @@
+@prefix eg: <http://example.org/> .
+
+eg:s
+ eg:p eg:o .
+
+<http://example.org/a-subject>
+ <http://example.org/a-predicate> <http://example.org/a-object> .
+
+()
+ <http://www.w3.org/2000/01/rdf-schema#label> "nil" .
diff --git a/test/root/README.md b/test/root/README.md
new file mode 100644
index 00000000..bec7db1e
--- /dev/null
+++ b/test/root/README.md
@@ -0,0 +1,5 @@
+Root Test Suite
+===============
+
+This small suite tests URI resolution against a base URI with or without a
+constraining root URI.
diff --git a/test/root/manifest.ttl b/test/root/manifest.ttl
new file mode 100644
index 00000000..90c6a527
--- /dev/null
+++ b/test/root/manifest.ttl
@@ -0,0 +1,27 @@
+@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix rdft: <http://www.w3.org/ns/rdftest#> .
+@prefix serd: <http://drobilla.net/ns/serd#> .
+
+<>
+ a mf:Manifest ;
+ rdfs:comment "Serd root URI test suite" ;
+ mf:entries (
+ <#root-inside-base>
+ <#root-outside-base>
+ ) .
+
+<#root-inside-base>
+ a rdft:TestTurtleEval ;
+ mf:action <root-inside-base-in.ttl> ;
+ mf:name "root-inside-base" ;
+ mf:result <root-inside-base-out.ttl> .
+
+<#root-outside-base>
+ a rdft:TestTurtleEval ;
+ mf:action <root-outside-base-in.ttl> ;
+ mf:name "root-outside-base" ;
+ mf:result <root-outside-base-out.ttl> .
+
+rdft:Test
+ rdfs:subClassOf mf:ManifestEntry .
diff --git a/test/root/root-inside-base-in.ttl b/test/root/root-inside-base-in.ttl
new file mode 100644
index 00000000..3fca79ec
--- /dev/null
+++ b/test/root/root-inside-base-in.ttl
@@ -0,0 +1,23 @@
+@base <http://example.org/top/> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+
+<http://example.org/top/>
+ rdfs:label "base node" .
+
+<http://example.org/top/root/>
+ rdfs:label "root node" .
+
+<http://example.org/top/root/s>
+ rdfs:label "within root" .
+
+<http://example.org/top/s>
+ rdfs:label "within base" .
+
+<http://example.org/other/s>
+ rdfs:label "outside base" .
+
+<http://example.com/s>
+ rdfs:label "outside domain" .
+
+<https://example.org/s>
+ rdfs:label "outside scheme" .
diff --git a/test/root/root-inside-base-out.ttl b/test/root/root-inside-base-out.ttl
new file mode 100644
index 00000000..a5081e4d
--- /dev/null
+++ b/test/root/root-inside-base-out.ttl
@@ -0,0 +1,23 @@
+@base <http://example.org/top/> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+
+<http://example.org/top/>
+ rdfs:label "base node" .
+
+<root/>
+ rdfs:label "root node" .
+
+<root/s>
+ rdfs:label "within root" .
+
+<s>
+ rdfs:label "within base" .
+
+<http://example.org/other/s>
+ rdfs:label "outside base" .
+
+<http://example.com/s>
+ rdfs:label "outside domain" .
+
+<https://example.org/s>
+ rdfs:label "outside scheme" .
diff --git a/test/root/root-outside-base-in.ttl b/test/root/root-outside-base-in.ttl
new file mode 100644
index 00000000..f0c9ef8a
--- /dev/null
+++ b/test/root/root-outside-base-in.ttl
@@ -0,0 +1,23 @@
+@base <http://example.org/top/root/base/> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+
+<http://example.org/top/root/base/>
+ rdfs:label "base node" .
+
+<http://example.org/top/root/>
+ rdfs:label "root node" .
+
+<http://example.org/top/root/base/s>
+ rdfs:label "within base" .
+
+<http://example.org/top/root/s>
+ rdfs:label "within root" .
+
+<http://example.org/top/s>
+ rdfs:label "outside root" .
+
+<http://example.com/s>
+ rdfs:label "outside domain" .
+
+<https://example.org/s>
+ rdfs:label "outside scheme" .
diff --git a/test/root/root-outside-base-out.ttl b/test/root/root-outside-base-out.ttl
new file mode 100644
index 00000000..47a4c47e
--- /dev/null
+++ b/test/root/root-outside-base-out.ttl
@@ -0,0 +1,23 @@
+@base <http://example.org/top/root/base/> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+
+<>
+ rdfs:label "base node" .
+
+<http://example.org/top/root/>
+ rdfs:label "root node" .
+
+<s>
+ rdfs:label "within base" .
+
+<../s>
+ rdfs:label "within root" .
+
+<../../s>
+ rdfs:label "outside root" .
+
+<http://example.com/s>
+ rdfs:label "outside domain" .
+
+<https://example.org/s>
+ rdfs:label "outside scheme" .