aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-03-29 19:59:50 -0400
committerDavid Robillard <d@drobilla.net>2023-04-05 09:45:15 -0400
commitf93c3fdd6c7d6ca61bec55d3c1ffae7e7c793913 (patch)
tree749ae66010fb5b8bfcf398c29ce252f9138cce5b /test
parentdd777c54b7585823be1f977e9dd887a5110a74f3 (diff)
downloadserd-f93c3fdd6c7d6ca61bec55d3c1ffae7e7c793913.tar.gz
serd-f93c3fdd6c7d6ca61bec55d3c1ffae7e7c793913.tar.bz2
serd-f93c3fdd6c7d6ca61bec55d3c1ffae7e7c793913.zip
Fix relative URI creation
Diffstat (limited to 'test')
-rw-r--r--test/pretty/manifest.ttl7
-rw-r--r--test/pretty/relative-uris.ttl2
-rw-r--r--test/root/root-inside-base-out.ttl4
-rw-r--r--test/root/root-outside-base-out.ttl4
-rw-r--r--test/test_uri.c13
5 files changed, 13 insertions, 17 deletions
diff --git a/test/pretty/manifest.ttl b/test/pretty/manifest.ttl
index 1f653d65..69b951af 100644
--- a/test/pretty/manifest.ttl
+++ b/test/pretty/manifest.ttl
@@ -32,6 +32,7 @@
<#many-objects>
<#named-graph>
<#nested-list-object>
+ <#relative-uris>
<#short-string-escapes>
<#uri-escapes>
<#nested-list-subject>
@@ -193,6 +194,12 @@
mf:name "nested-list-subject" ;
mf:result <nested-list-subject.ttl> .
+<#relative-uris>
+ a rdft:TestTurtleEval ;
+ mf:action <relative-uris.ttl> ;
+ mf:name "relative-uris" ;
+ mf:result <relative-uris.ttl> .
+
<#short-string-escapes>
a rdft:TestTurtleEval ;
mf:action <short-string-escapes.ttl> ;
diff --git a/test/pretty/relative-uris.ttl b/test/pretty/relative-uris.ttl
new file mode 100644
index 00000000..397c7cf7
--- /dev/null
+++ b/test/pretty/relative-uris.ttl
@@ -0,0 +1,2 @@
+<http://example.org/s>
+ <http://example.org/p> <manifest.ttl> .
diff --git a/test/root/root-inside-base-out.ttl b/test/root/root-inside-base-out.ttl
index a5081e4d..76f61791 100644
--- a/test/root/root-inside-base-out.ttl
+++ b/test/root/root-inside-base-out.ttl
@@ -1,7 +1,7 @@
@base <http://example.org/top/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-<http://example.org/top/>
+<>
rdfs:label "base node" .
<root/>
@@ -10,7 +10,7 @@
<root/s>
rdfs:label "within root" .
-<s>
+<http://example.org/top/s>
rdfs:label "within base" .
<http://example.org/other/s>
diff --git a/test/root/root-outside-base-out.ttl b/test/root/root-outside-base-out.ttl
index 47a4c47e..dcb95d5a 100644
--- a/test/root/root-outside-base-out.ttl
+++ b/test/root/root-outside-base-out.ttl
@@ -4,7 +4,7 @@
<>
rdfs:label "base node" .
-<http://example.org/top/root/>
+<../>
rdfs:label "root node" .
<s>
@@ -13,7 +13,7 @@
<../s>
rdfs:label "within root" .
-<../../s>
+<http://example.org/top/s>
rdfs:label "outside root" .
<http://example.com/s>
diff --git a/test/test_uri.c b/test/test_uri.c
index bcd670e5..ac24a2be 100644
--- a/test/test_uri.c
+++ b/test/test_uri.c
@@ -265,12 +265,8 @@ test_relative_uri(void)
// Related base
- /* Expected:
check_relative_uri(
"http://example.org/a/b", "http://example.org/", NULL, "a/b");
- Actual: */
- check_relative_uri(
- "http://example.org/a/b", "http://example.org/", NULL, "/a/b");
check_relative_uri(
"http://example.org/a/b", "http://example.org/a/", NULL, "b");
@@ -286,10 +282,7 @@ test_relative_uri(void)
check_relative_uri("http://example.org/", "http://example.org/", NULL, "");
- /* Expected:
check_relative_uri("http://example.org/", "http://example.org/a", NULL, "");
- Actual: */
- check_relative_uri("http://example.org/", "http://example.org/a", NULL, "/");
check_relative_uri(
"http://example.org/", "http://example.org/a/", NULL, "../");
@@ -337,10 +330,7 @@ test_relative_uri(void)
check_relative_uri("http://example.org/a/",
"http://example.org/a/",
"http://example.org/a/",
- /* Expected:
"");
- Actual: */
- "http://example.org/a/");
check_relative_uri("http://example.org/a/b",
"http://example.org/a/b/c",
@@ -350,10 +340,7 @@ test_relative_uri(void)
check_relative_uri("http://example.org/a",
"http://example.org/a/b/c",
"http://example.org/a/b",
- /* Expected:
"http://example.org/a");
- Actual: */
- "../../a");
}
int