From d40b42c77d65347871beeee7baf9afa9e138e086 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Thu, 27 Dec 2018 20:44:12 +0100 Subject: [PATCH] Add additional tests for extract_urls --- test/menu.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/menu.c b/test/menu.c index 93fd4c0..b578ae1 100644 --- a/test/menu.c +++ b/test/menu.c @@ -39,6 +39,29 @@ TEST test_extract_urls_from_two_url_string(void) 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) { @@ -46,5 +69,8 @@ SUITE(suite_menu) RUN_TEST(test_extract_urls_from_no_urls_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_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: */