aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_caret.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-05-05 09:43:57 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:08 -0500
commit4711fdf527f416faee8ff19e15f050d4b48dcfb2 (patch)
tree6b18712ec44cce5713ddef1a21aec5f12651d901 /test/test_caret.c
parent248a874d7425749d29cf900a1c3783c624ea8d8c (diff)
downloadserd-4711fdf527f416faee8ff19e15f050d4b48dcfb2.tar.gz
serd-4711fdf527f416faee8ff19e15f050d4b48dcfb2.tar.bz2
serd-4711fdf527f416faee8ff19e15f050d4b48dcfb2.zip
[WIP] Generalize node construction API
Diffstat (limited to 'test/test_caret.c')
-rw-r--r--test/test_caret.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/test_caret.c b/test/test_caret.c
index a97b3d0f..9374f65b 100644
--- a/test/test_caret.c
+++ b/test/test_caret.c
@@ -7,7 +7,6 @@
#include "serd/caret.h"
#include "serd/node.h"
-#include "serd/string_view.h"
#include <assert.h>
#include <stddef.h>
@@ -16,7 +15,7 @@
static int
test_caret(void)
{
- SerdNode* const node = serd_new_string(NULL, serd_string("node"));
+ SerdNode* const node = serd_node_new(NULL, serd_a_string("node"));
SerdCaret* const caret = serd_caret_new(NULL, node, 46, 2);
assert(serd_caret_equals(caret, caret));
@@ -29,7 +28,7 @@ test_caret(void)
assert(serd_caret_equals(caret, copy));
assert(!serd_caret_copy(NULL, NULL));
- SerdNode* const other_node = serd_new_string(NULL, serd_string("other"));
+ SerdNode* const other_node = serd_node_new(NULL, serd_a_string("other"));
SerdCaret* const other_file = serd_caret_new(NULL, other_node, 46, 2);
SerdCaret* const other_line = serd_caret_new(NULL, node, 47, 2);
SerdCaret* const other_col = serd_caret_new(NULL, node, 46, 3);
@@ -54,8 +53,12 @@ test_caret(void)
static void
test_failed_alloc(void)
{
- SerdNode* node = serd_new_token(NULL, SERD_LITERAL, serd_string("node"));
+ char node_buf[32];
+ assert(!serd_node_construct(sizeof(node_buf), node_buf, serd_a_string("node"))
+ .status);
+
+ const SerdNode* node = (const SerdNode*)node_buf;
SerdFailingAllocator allocator = serd_failing_allocator();
// Successfully allocate a new caret to count the number of allocations
@@ -84,7 +87,6 @@ test_failed_alloc(void)
serd_caret_free(&allocator.base, copy);
serd_caret_free(&allocator.base, caret);
- serd_node_free(NULL, node);
}
int