diff options
author | David Robillard <d@drobilla.net> | 2021-08-12 22:28:59 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-01-28 21:57:07 -0500 |
commit | 1409f161793a289819df1f31eccb579b71f45475 (patch) | |
tree | 4076c291a397f0a0a2ea560305ee87c47810df33 /src/writer.c | |
parent | 6ffe331cfc8af0735b263ab7af6f84b1b4418102 (diff) | |
download | serd-1409f161793a289819df1f31eccb579b71f45475.tar.gz serd-1409f161793a289819df1f31eccb579b71f45475.tar.bz2 serd-1409f161793a289819df1f31eccb579b71f45475.zip |
Fix pretty-printing nested empty lists and add test suite
The earlier "test" was just hitting the code without actually checking the
output. This new suite is a set of pretty-printed documents which serd must
reproduce from a model exactly to pass. This should make it easy to add cases
in the future, since each case is just a document, as it should look.
Diffstat (limited to 'src/writer.c')
-rw-r--r-- | src/writer.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/writer.c b/src/writer.c index 5f9fdaab..452d3679 100644 --- a/src/writer.c +++ b/src/writer.c @@ -1064,6 +1064,11 @@ write_list_statement(SerdWriter* const writer, SerdStatus st = SERD_SUCCESS; bool is_end = false; + if (serd_node_equals(predicate, writer->world->rdf_first) && + serd_node_equals(object, writer->world->rdf_nil)) { + return esink("()", 2, writer); + } + TRY(st, write_list_obj(writer, flags, predicate, object, &is_end)); if (is_end) { pop_context(writer); |