summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-02-02 20:14:05 +0000
committerDavid Robillard <d@drobilla.net>2013-02-02 20:14:05 +0000
commitbf23b9f975ec97d20ba6381f2457e7b7d6ec0369 (patch)
tree52df2281c1dba7fed598e55d5dabe9e219f84a65 /test
parentdd51340700469210bbbff0424f6ebe85d32e9524 (diff)
downloadlilv-bf23b9f975ec97d20ba6381f2457e7b7d6ec0369.tar.gz
lilv-bf23b9f975ec97d20ba6381f2457e7b7d6ec0369.tar.bz2
lilv-bf23b9f975ec97d20ba6381f2457e7b7d6ec0369.zip
Require a URI for lilv_state_to_string() and fail gracefully otherwise.
Fail gracefully when lilv_state_new_from_string() is called on NULL. Fixes #865. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5030 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'test')
-rw-r--r--test/lilv_test.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/lilv_test.c b/test/lilv_test.c
index f6976f6..0033885 100644
--- a/test/lilv_test.c
+++ b/test/lilv_test.c
@@ -1227,6 +1227,15 @@ test_state(void)
// Ensure they are equal
TEST_ASSERT(lilv_state_equals(state, state2));
+ // Check that we can't save a state with no URI
+ char* bad_state_str = lilv_state_to_string(
+ world, &map, &unmap, state, NULL, NULL);
+ TEST_ASSERT(!bad_state_str);
+
+ // Check that we can't restore the NULL string (and it doesn't crash)
+ LilvState* bad_state = lilv_state_new_from_string(world, &map, NULL);
+ TEST_ASSERT(!bad_state);
+
// Save state to a string
char* state1_str = lilv_state_to_string(
world, &map, &unmap, state, "http://example.org/state1", NULL);