summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-03-13 21:53:42 +0000
committerVincent Sanders <vince@kyllikki.org>2017-03-13 21:53:42 +0000
commitd55d7f3e1e50ad4b5199d1ea84922fedff859e78 (patch)
treec4954081c8d22ae3c9bd1ce60e055a50999a8315
parentce6c0b9026bbe663f0d8980acde937543baca522 (diff)
downloadnetsurf-d55d7f3e1e50ad4b5199d1ea84922fedff859e78.tar.gz
netsurf-d55d7f3e1e50ad4b5199d1ea84922fedff859e78.tar.bz2
add urldb tests for urls which cannot be found
-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);