diff options
author | Xan Lopez <xan@igalia.com> | 2012-09-04 21:41:50 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2012-09-04 21:41:50 +0800 |
commit | f5bf150a91bec3f25f37f567a2d4b7927b3c7a21 (patch) | |
tree | d7cffc21501a540b8e90be39d1abbeb94bb0273f | |
parent | c11081599dd7f6b9f2c1fd627afa8af93d99fa0e (diff) | |
download | gsoc2013-epiphany-f5bf150a91bec3f25f37f567a2d4b7927b3c7a21.tar gsoc2013-epiphany-f5bf150a91bec3f25f37f567a2d4b7927b3c7a21.tar.gz gsoc2013-epiphany-f5bf150a91bec3f25f37f567a2d4b7927b3c7a21.tar.bz2 gsoc2013-epiphany-f5bf150a91bec3f25f37f567a2d4b7927b3c7a21.tar.lz gsoc2013-epiphany-f5bf150a91bec3f25f37f567a2d4b7927b3c7a21.tar.xz gsoc2013-epiphany-f5bf150a91bec3f25f37f567a2d4b7927b3c7a21.tar.zst gsoc2013-epiphany-f5bf150a91bec3f25f37f567a2d4b7927b3c7a21.zip |
tests: test ephy_embed_utils_url_is_empty
-rw-r--r-- | tests/ephy-embed-utils-test.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/ephy-embed-utils-test.c b/tests/ephy-embed-utils-test.c index 669013c2c..53e0677d5 100644 --- a/tests/ephy-embed-utils-test.c +++ b/tests/ephy-embed-utils-test.c @@ -38,6 +38,12 @@ typedef struct { const char *result; } NormalizeTest; +typedef struct { + const char *name; + const char *test; + gboolean result; +} IsEmptyTest; + static const SchemeTest tests_has_scheme[] = { { "http", "http://www.gnome.org/" }, { "http_with_port", "http://www.gnome.org:8080" }, @@ -81,6 +87,15 @@ static const NormalizeTest tests_normalize[] = { { "untouched_http", "http://gnome.org", "http://gnome.org" }, }; +static const IsEmptyTest tests_is_empty[] = { + { "NULL", NULL, TRUE }, + { "zero-length", "", TRUE }, + { "about:blank", "about:blank", TRUE }, + { "about:blanco", "about:blanco", FALSE }, + { "non-blank-URI", "http://www.gnome.org", FALSE }, + { "random", "what is this, I don't even", FALSE } +}; + static void test_address_no_web_scheme (const char *test) { @@ -104,6 +119,12 @@ test_normalize_address (const NormalizeTest *test) g_free (normalized); } +static void +test_is_empty (const IsEmptyTest *test) +{ + g_assert (ephy_embed_utils_url_is_empty (test->test) == test->result); +} + int main (int argc, char *argv[]) { @@ -152,5 +173,19 @@ main (int argc, char *argv[]) g_free (test_name); } + for (i = 0; i < G_N_ELEMENTS (tests_is_empty); i++) { + IsEmptyTest test; + char *test_name; + + test = tests_is_empty[i]; + test_name = g_strconcat ("/embed/ephy-embed-utils/is_empty_", + test.name, NULL); + + g_test_add_data_func (test_name, tests_is_empty + i, + (GTestDataFunc)test_is_empty); + + g_free (test_name); + } + return g_test_run (); } |