diff options
author | David Robillard <d@drobilla.net> | 2015-10-04 19:22:43 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-10-04 19:22:43 +0000 |
commit | 3f4d613ed7556d8420e7edebe1530c75193be5d0 (patch) | |
tree | 93e520baabf86165123079106ea8a2963d57f560 /src/syntax.c | |
parent | 73e41c329b66b53368bd40030c7a1fb3e17339a7 (diff) | |
download | sord-3f4d613ed7556d8420e7edebe1530c75193be5d0.tar.gz sord-3f4d613ed7556d8420e7edebe1530c75193be5d0.tar.bz2 sord-3f4d613ed7556d8420e7edebe1530c75193be5d0.zip |
Improve test coverage
git-svn-id: http://svn.drobilla.net/sord/trunk@335 3d64ff67-21c5-427c-a301-fe4f08042e5a
Diffstat (limited to 'src/syntax.c')
-rw-r--r-- | src/syntax.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/syntax.c b/src/syntax.c index 9c7fa74..f17312f 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -112,7 +112,7 @@ sord_new_reader(SordModel* model, return reader; } -static void +static SerdStatus write_statement(SordModel* sord, SerdWriter* writer, SordQuad tup, @@ -140,7 +140,7 @@ write_statement(SordModel* sord, // TODO: Subject abbreviation if (sord_node_is_inline_object(s) && !(flags & SERD_ANON_CONT)) { - return; + return SERD_SUCCESS; } SerdStatus st = SERD_SUCCESS; @@ -156,10 +156,10 @@ write_statement(SordModel* sord, if (!st && sub_iter) { flags |= SERD_ANON_CONT; - for (; !sord_iter_end(sub_iter); sord_iter_next(sub_iter)) { + for (; !st && !sord_iter_end(sub_iter); sord_iter_next(sub_iter)) { SordQuad sub_tup; sord_iter_get(sub_iter, sub_tup); - write_statement(sord, writer, sub_tup, flags); + st = write_statement(sord, writer, sub_tup, flags); } sord_iter_free(sub_iter); serd_writer_end_anon(writer, so); @@ -169,11 +169,7 @@ write_statement(SordModel* sord, writer, flags, NULL, ss, sp, so, sd, &language); } - if (st) { - fprintf(stderr, "Failed to write statement (%s)\n", - serd_strerror(st)); - return; - } + return st; } bool @@ -195,11 +191,13 @@ sord_write_iter(SordIter* iter, } SordModel* model = (SordModel*)sord_iter_get_model(iter); - for (; !sord_iter_end(iter); sord_iter_next(iter)) { + SerdStatus st = SERD_SUCCESS; + for (; !st && !sord_iter_end(iter); sord_iter_next(iter)) { SordQuad tup; sord_iter_get(iter, tup); - write_statement(model, writer, tup, 0); + st = write_statement(model, writer, tup, 0); } sord_iter_free(iter); - return true; + + return !st; } |