summaryrefslogtreecommitdiff
path: root/test/urldbtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/urldbtest.c')
-rw-r--r--test/urldbtest.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/urldbtest.c b/test/urldbtest.c
index 01cee7948..3c43833e5 100644
--- a/test/urldbtest.c
+++ b/test/urldbtest.c
@@ -1011,6 +1011,49 @@ END_TEST
/**
+ * Test urldb find failing for differing bad url.
+ */
+START_TEST(urldb_api_url_find_test)
+{
+ nsurl *url;
+ nserror res;
+
+ urldb_create();
+
+ /* search for a url with mailto scheme */
+ res = nsurl_create("mailto:", &url);
+ ck_assert_int_eq(res, NSERROR_OK);
+
+ res = urldb_set_url_persistence(url, true);
+ ck_assert_int_eq(res, NSERROR_NOT_FOUND);
+
+ nsurl_unref(url);
+
+ /* search for a url with odd scheme and no host */
+ res = nsurl_create("fish:///", &url);
+ ck_assert_int_eq(res, NSERROR_OK);
+ ck_assert(nsurl_has_component(url, NSURL_HOST) == false);
+
+ res = urldb_set_url_persistence(url, true);
+ ck_assert_int_eq(res, NSERROR_NOT_FOUND);
+
+ nsurl_unref(url);
+
+ /* search for a url with not found url */
+ res = nsurl_create("http://no.example.com/", &url);
+ ck_assert_int_eq(res, NSERROR_OK);
+ ck_assert(nsurl_has_component(url, NSURL_HOST) == true);
+
+ res = urldb_set_url_persistence(url, true);
+ ck_assert_int_eq(res, NSERROR_NOT_FOUND);
+
+ nsurl_unref(url);
+
+
+}
+END_TEST
+
+/**
* test url database finalisation without initialisation.
*/
START_TEST(urldb_api_destroy_no_init_test)
@@ -1032,6 +1075,8 @@ static TCase *urldb_api_case_create(void)
urldb_api_add_url_assert_test,
6);
+ tcase_add_test(tc, urldb_api_url_find_test);
+
tcase_add_test(tc, urldb_api_destroy_no_init_test);