Commit 4259e00e authored by Christian Kellner's avatar Christian Kellner

test: store: loading empty keys gives ERROR_NOKEY

Check that loading empty key (zero content or one whitespace) files
via bolt_key_load_file does result in BOLT_ERROR_NOKEY.
parent 20ef8803
......@@ -351,6 +351,19 @@ test_key (TestStore *tt, gconstpointer user_data)
g_assert_error (err, BOLT_ERROR, BOLT_ERROR_BADKEY);
g_assert_null (loaded);
g_clear_error (&err);
/* empty key file ("", or "\n") */
for (gssize i = 0; i < 2; i++)
ok = g_file_set_contents (p, "\n", i, &err);
g_assert_no_error (err);
g_assert_true (ok);
loaded = bolt_key_load_file (f, &err);
g_assert_error (err, BOLT_ERROR, BOLT_ERROR_NOKEY);
g_assert_null (loaded);
g_clear_error (&err);
static GLogWriterOutput
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment