diff options
author | David Robillard <d@drobilla.net> | 2013-03-30 02:03:29 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-03-30 02:03:29 +0000 |
commit | 7c662143ede945ac5a96b95ed2d243580f00635a (patch) | |
tree | f6f9d44a6b5750dccd126be58207e1a0864c7b5e | |
parent | e6f2680dc5e4a5c0578a1996786099c819779053 (diff) | |
download | serd-7c662143ede945ac5a96b95ed2d243580f00635a.tar.gz serd-7c662143ede945ac5a96b95ed2d243580f00635a.tar.bz2 serd-7c662143ede945ac5a96b95ed2d243580f00635a.zip |
Improve branch coverage.
git-svn-id: http://svn.drobilla.net/serd/trunk@442 490d8e77-9747-427b-9fa3-0b8f29cee8a0
-rw-r--r-- | src/uri.c | 2 | ||||
-rw-r--r-- | tests/serd_test.c | 8 |
2 files changed, 8 insertions, 2 deletions
@@ -325,7 +325,7 @@ merge(SerdChunk* base, SerdChunk* path) const uint8_t* begin = remove_dot_segments(path->buf, path->len, &up); const uint8_t* end = path->buf + path->len; - if (base->buf && base->len > 0) { + if (base->len) { // Find the up'th last slash const uint8_t* base_last = (base->buf + base->len - 1); ++up; diff --git a/tests/serd_test.c b/tests/serd_test.c index 259f244a..268f1a85 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -398,7 +398,9 @@ main(void) SerdNode base = serd_node_new_uri_from_string(USTR("http://example.org/"), NULL, &base_uri); SerdNode nil = serd_node_new_uri_from_string(NULL, &base_uri, NULL); - if (nil.type != SERD_URI || strcmp((const char*)nil.buf, (const char*)base.buf)) { + SerdNode nil2 = serd_node_new_uri_from_string(USTR(""), &base_uri, NULL); + if (nil.type != SERD_URI || strcmp((const char*)nil.buf, (const char*)base.buf) || + 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); @@ -416,6 +418,10 @@ main(void) return failure("Set base URI to %s\n", node.buf); } + if (!serd_node_equals(serd_env_get_base_uri(env, NULL), &node)) { + return failure("Base URI mismatch\n"); + } + SerdChunk prefix, suffix; if (!serd_env_expand(env, &b, &prefix, &suffix)) { return failure("Expanded invalid curie %s\n", b.buf); |