add url databse write output to unit test

This commit is contained in:
Vincent Sanders 2016-08-08 23:13:23 +01:00
parent 4448fa6cbf
commit 958fb6aa5e
2 changed files with 19 additions and 4 deletions

View File

@ -592,7 +592,7 @@ static nserror failing_init_cb(struct nsoption_s *defaults)
} }
/** /**
* Test default initialisation waith failing callback * Test default initialisation with failing callback
*/ */
START_TEST(nsoption_api_init_failcb_test) START_TEST(nsoption_api_init_failcb_test)
{ {

View File

@ -373,7 +373,7 @@ END_TEST
TCase *urldb_original_case_create(void) TCase *urldb_original_case_create(void)
{ {
TCase *tc; TCase *tc;
tc = tcase_create("Original urldb tests"); tc = tcase_create("Original_tests");
/* ensure corestrings are initialised and finalised for every test */ /* ensure corestrings are initialised and finalised for every test */
tcase_add_checked_fixture(tc, tcase_add_checked_fixture(tc,
@ -388,18 +388,33 @@ TCase *urldb_original_case_create(void)
START_TEST(urldb_session_test) START_TEST(urldb_session_test)
{ {
nserror res; nserror res;
char *outnam;
/* writing output requires options initialising */
res = nsoption_init(NULL, NULL, NULL);
ck_assert_int_eq(res, NSERROR_OK);
res = urldb_load(test_urldb_path); res = urldb_load(test_urldb_path);
ck_assert_int_eq(res, NSERROR_OK); ck_assert_int_eq(res, NSERROR_OK);
/* write database out */
outnam = tmpnam(NULL);
res = urldb_save(outnam);
ck_assert_int_eq(res, NSERROR_OK);
urldb_destroy(); urldb_destroy();
/* finalise options */
res = nsoption_finalise(NULL, NULL);
ck_assert_int_eq(res, NSERROR_OK);
} }
END_TEST END_TEST
TCase *urldb_session_case_create(void) TCase *urldb_session_case_create(void)
{ {
TCase *tc; TCase *tc;
tc = tcase_create("Full session"); tc = tcase_create("Full_session");
/* ensure corestrings are initialised and finalised for every test */ /* ensure corestrings are initialised and finalised for every test */
tcase_add_checked_fixture(tc, tcase_add_checked_fixture(tc,
@ -426,7 +441,7 @@ END_TEST
TCase *urldb_api_case_create(void) TCase *urldb_api_case_create(void)
{ {
TCase *tc; TCase *tc;
tc = tcase_create("API checks"); tc = tcase_create("API_checks");
tcase_add_test_raise_signal(tc, tcase_add_test_raise_signal(tc,
urldb_api_add_host_assert_test, urldb_api_add_host_assert_test,