aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/serd_test.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c
index da567a35..4278a089 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -532,8 +532,8 @@ main(void)
// Rewind and test reader
fseek(fd, 0, SEEK_SET);
- ReaderTest* rt = (ReaderTest*)calloc(1, sizeof(ReaderTest));
- SerdSink sink = { rt, NULL, NULL, test_sink, NULL };
+ ReaderTest rt = { 0, NULL };
+ SerdSink sink = { &rt, NULL, NULL, test_sink, NULL };
SerdReader* reader = serd_reader_new(world, SERD_TURTLE, &sink);
assert(reader);
@@ -543,20 +543,18 @@ main(void)
serd_reader_add_blank_prefix(reader, NULL);
serd_node_free(g);
- assert(serd_reader_read_file(reader, "http://notafile"));
- assert(serd_reader_read_file(reader, "file:///better/not/exist"));
- assert(serd_reader_read_file(reader, "file://"));
+ assert(serd_reader_start_file(reader, "http://notafile", false));
+ assert(serd_reader_start_file(reader, "file://invalid", false));
+ assert(serd_reader_start_file(reader, "file:///nonexistant", false));
- const SerdStatus st = serd_reader_read_file(reader, path);
- assert(!st);
- assert(rt->n_statements == 13);
- assert(rt->graph && serd_node_get_string(rt->graph) &&
- !strcmp(serd_node_get_string(rt->graph), "http://example.org/"));
-
- assert(serd_reader_read_string(reader, "This isn't Turtle at all."));
+ assert(!serd_reader_start_file(reader, path, true));
+ assert(!serd_reader_read_document(reader));
+ assert(rt.n_statements == 13);
+ assert(rt.graph && serd_node_get_string(rt.graph) &&
+ !strcmp(serd_node_get_string(rt.graph), "http://example.org/"));
+ serd_reader_finish(reader);
serd_reader_free(reader);
- free(rt);
fclose(fd);
serd_env_free(env);