Add additional tests for extract_urls

This commit is contained in:
Benedikt Heine 2018-12-27 20:44:12 +01:00
parent db350883cc
commit d40b42c77d

View File

@ -39,6 +39,29 @@ TEST test_extract_urls_from_two_url_string(void)
PASS(); PASS();
} }
TEST test_extract_urls_from_one_url_port(void)
{
char *urls = extract_urls("Hi from https://www.example.com:8100 and have a nice day!");
ASSERT_STR_EQ("https://www.example.com:8100", urls);
g_free(urls);
PASS();
}
TEST test_extract_urls_from_one_url_path(void)
{
char *urls = extract_urls("Hi from https://www.example.com:8100/testpath and have a nice day!");
ASSERT_STR_EQ("https://www.example.com:8100/testpath", urls);
g_free(urls);
PASS();
}
TEST test_extract_urls_from_one_url_anchor(void)
{
char *urls = extract_urls("Hi from https://www.example.com:8100/testpath#anchor and have a nice day!");
ASSERT_STR_EQ("https://www.example.com:8100/testpath#anchor", urls);
g_free(urls);
PASS();
}
SUITE(suite_menu) SUITE(suite_menu)
{ {
@ -46,5 +69,8 @@ SUITE(suite_menu)
RUN_TEST(test_extract_urls_from_no_urls_string); RUN_TEST(test_extract_urls_from_no_urls_string);
RUN_TEST(test_extract_urls_from_one_url_string); RUN_TEST(test_extract_urls_from_one_url_string);
RUN_TEST(test_extract_urls_from_two_url_string); RUN_TEST(test_extract_urls_from_two_url_string);
RUN_TEST(test_extract_urls_from_one_url_port);
RUN_TEST(test_extract_urls_from_one_url_path);
RUN_TEST(test_extract_urls_from_one_url_anchor);
} }
/* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */ /* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */