aboutsummaryrefslogtreecommitdiffstats
path: root/tests/serd_test.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-07-10 19:07:14 -0400
committerDavid Robillard <d@drobilla.net>2016-07-10 19:07:14 -0400
commit1e8c93c6e760c4453c4fd1f471feebd7886692d3 (patch)
tree0a7b77f7f27db3ceb401658cf18c883352dc7308 /tests/serd_test.c
parentaf9356818981e83d5eb9430d4717b19c7316c154 (diff)
downloadserd-1e8c93c6e760c4453c4fd1f471feebd7886692d3.tar.gz
serd-1e8c93c6e760c4453c4fd1f471feebd7886692d3.tar.bz2
serd-1e8c93c6e760c4453c4fd1f471feebd7886692d3.zip
Add serd_node_new_relative_uri()
Diffstat (limited to 'tests/serd_test.c')
-rw-r--r--tests/serd_test.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c
index a0a6c47f..14534878 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -1,5 +1,5 @@
/*
- Copyright 2011-2015 David Robillard <http://drobilla.net>
+ Copyright 2011-2016 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -415,10 +415,22 @@ main(void)
nil2.type != SERD_URI || strcmp((const char*)nil2.buf, (const char*)base.buf)) {
return failure("URI %s != base %s\n", nil.buf, base.buf);
}
- serd_node_free(&base);
serd_node_free(&nil);
serd_node_free(&nil2);
+ // Test serd_node_new_relative_uri
+ SerdNode abs = serd_node_from_string(SERD_URI, USTR("http://example.org/foo/bar"));
+ SerdURI abs_uri;
+ serd_uri_parse(abs.buf, &abs_uri);
+
+ SerdURI rel_uri;
+ SerdNode rel = serd_node_new_relative_uri(&abs_uri, &base_uri, NULL, &rel_uri);
+ if (strcmp((const char*)rel.buf, "/foo/bar")) {
+ return failure("Bad relative URI %s (expected '/foo/bar')\n", rel.buf);
+ }
+
+ serd_node_free(&base);
+
// Test SerdEnv
SerdNode u = serd_node_from_string(SERD_URI, USTR("http://example.org/foo"));