aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_reader_writer.c
AgeCommit message (Collapse)AuthorFilesLines
2022-01-28Make environments and sinks part of the worldDavid Robillard1-7/+10
Although functions/components that require minimal pre-existing state are nice, these allocate memory and could potentially share resources. So, give them a pointer to a world which can be used to configure such things. In particular, this is working towards supporting custom allocators everywhere.
2022-01-28Use more human-readable status codesDavid Robillard1-2/+2
2022-01-28Simplify input stream APIDavid Robillard1-3/+3
More or less the same rationale as the previous commit, but for reading. This makes for nice symmetry with writing, at the cost of a slightly more annoying reader interface since the source doesn't know its block size or name.
2022-01-28Simplify output stream APIDavid Robillard1-7/+7
This makes the paging mechanism an internal detail once again. While it's conceptually elegant to simply have a single write interface and have the block dumper just be another implementation of that, unfortunately it is not practical. The inlining of serd_block_dumper_write() is a significant performance boost, because it avoids a non-inlinable function call of overhead per character. Compared to the SerdByteSink approach, this removes the burden and overhead of needing to dynamically allocate the structure itself.
2022-01-28Provide a full output stream implementation for SerdBufferDavid Robillard1-1/+1
Essentially replaces serd_buffer_sink_finish() with serd_buffer_close(), which makes writing to a buffer consistent with writing to a file or anything else.
2022-01-28Make blank node prefixing automaticDavid Robillard1-14/+0
Though potentially useful, I don't think the complexity cost of the old interface (both to the implementation and to the user) is worth it. A special tool to transform blank node labels (for example with regular expressions) would be a better approach to this if it's ever needed in the future.
2022-01-28Add a close function to SerdByteSinkDavid Robillard1-3/+2
This simplifies everything by replacing special cases with a more general close function. A type is no longer stored in the structure, so the other constructors are now essentially syntactic sugar for the universal serd_byte_sink_new_function().
2022-01-14Preserve long or short quoting from input documentsDavid Robillard1-2/+2
2022-01-14Move SerdEnv mutation from writer to readerDavid Robillard1-3/+6
Writing having side-effects seems questionable in general, and this prepares things for expanding URIs in the reader.
2022-01-13Make Reader always read from a ByteSourceDavid Robillard1-8/+5
2022-01-13Fix crash when attempting to read before startingDavid Robillard1-0/+3
2022-01-13Replace serd_reader_set_strict() with SerdReaderFlagsDavid Robillard1-2/+2
2022-01-13Split out simple reader unit testsDavid Robillard1-176/+0
2022-01-13Make Writer always write to a ByteSinkDavid Robillard1-7/+10
2022-01-13Replace SERD_WRITE_STRICT flag with SERD_WRITE_LAXDavid Robillard1-2/+2
The unset value for flags should represent the best default, which in this case is strict parsing. Lax parsing is the riskier opt-in option.
2022-01-13Separate ByteSink from writerDavid Robillard1-3/+7
2022-01-13Replace multiple stream callbacks with SerdEventDavid Robillard1-22/+14
This makes plumbing easier since everything goes through the same "stream" and only one callback is required to handling everything. It's also more easily extensible in case more event types need to be added in the future.
2022-01-13Use SerdNodes to simplify some testsDavid Robillard1-25/+18
2022-01-13Add SerdStatementDavid Robillard1-10/+6
2022-01-13Add SerdCaretDavid Robillard1-1/+2
2022-01-13Remove serd_reader_set_default_graph()David Robillard1-37/+23
2022-01-13Add SerdWorld for shared library stateDavid Robillard1-8/+18
2022-01-13Clean up nodes in reader/writer testsDavid Robillard1-12/+20
2022-01-13Simplify literal construction APIDavid Robillard1-3/+2
2022-01-13Use a fixed-size reader stackDavid Robillard1-7/+10
2022-01-13Simplify reader interfaceDavid Robillard1-28/+33
2022-01-13Add SerdSink interface and hide implementationsDavid Robillard1-28/+37
2022-01-13Bring read/write interface closer to C standardDavid Robillard1-2/+3
2022-01-13Simplify node construction APIDavid Robillard1-21/+29
2022-01-13Merge datatype/language into nodeDavid Robillard1-43/+15
This moves closer to the sord API, and is more convenient in most cases.
2022-01-13Make nodes opaqueDavid Robillard1-53/+48
2022-01-13Remove "get" from accessor namesDavid Robillard1-4/+4
2022-01-13Rename SerdStyle to SerdWriterFlagsDavid Robillard1-5/+4
2022-01-13Use char* for strings in public APIDavid Robillard1-29/+27
The constant casting just makes user code a mess, for no benefit.
2022-01-13Add SerdBuffer type for mutable buffersDavid Robillard1-5/+5
This avoids const violations from abusing SerdChunk as a mutable buffer for string sinks.
2021-07-10Fix out of bounds read in testDavid Robillard1-0/+4
2021-07-10Clean up socket-like stream reading testDavid Robillard1-5/+17
2021-04-09Write statements with invalid URI characters in lax modeDavid Robillard1-0/+1
2021-01-02Use email address instead of website for attributionDavid Robillard1-1/+1
2020-12-31Format all code with clang-formatDavid Robillard1-261/+268
2020-11-13Remove tests that pass null to nonnull parametersDavid Robillard1-6/+2
2020-11-11Add nonnull and nullable attributes to APIDavid Robillard1-0/+8
This will warn if NULL is passed to any nonnull-annotated parameter, and is also supported by sanitizers which can check for violations at runtime. Unfortunately, it is currently only supported by clang. GCC has a similar feature in the nonnull attribute, but this has a different syntax (it's a function attribute) and is more dangerous since it is used by the optimizer to assume a null pointer is undefined behavior. This one just warns and still allows code to handle the situation gracefully, which I think is more appropriate for a library API. Note that this optimization behavior is not some unlikely edge case: switching these attributes to the GCC one will break release builds.
2020-11-09Add a test for reading strings with no trailing newlineDavid Robillard1-0/+23
2020-11-09Split out reader and writer testsDavid Robillard1-0/+329