| 6 | |
| 7 | Y_UNIT_TEST_SUITE(TUtilUrlTest) { |
| 8 | Y_UNIT_TEST(TestGetHostAndGetHostAndPort) { |
| 9 | UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru/bebe")); |
| 10 | UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHostAndPort("ya.ru/bebe")); |
| 11 | UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru")); |
| 12 | UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHostAndPort("ya.ru")); |
| 13 | UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru:8080")); |
| 14 | UNIT_ASSERT_VALUES_EQUAL("ya.ru:8080", GetHostAndPort("ya.ru:8080")); |
| 15 | UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru/bebe:8080")); |
| 16 | UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHostAndPort("ya.ru/bebe:8080")); |
| 17 | UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru:8080/bebe")); |
| 18 | UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("https://ya.ru:8080/bebe")); |
| 19 | UNIT_ASSERT_VALUES_EQUAL("www.ya.ru", GetHost("www.ya.ru:8080/bebe")); |
| 20 | UNIT_ASSERT_VALUES_EQUAL("www.ya.ru", GetHost("https://www.ya.ru:8080/bebe")); |
| 21 | UNIT_ASSERT_VALUES_EQUAL("ya.ru:8080", GetHostAndPort("ya.ru:8080/bebe")); |
| 22 | // irl RFC3986 sometimes gets ignored |
| 23 | UNIT_ASSERT_VALUES_EQUAL("pravda-kmv.ru", GetHost("pravda-kmv.ru?page=news&id=6973")); |
| 24 | UNIT_ASSERT_VALUES_EQUAL("pravda-kmv.ru", GetHostAndPort("pravda-kmv.ru?page=news&id=6973")); |
| 25 | // check simple string |
| 26 | UNIT_ASSERT_VALUES_EQUAL("some_blender_url", GetHost("some_blender_url")); |
| 27 | UNIT_ASSERT_VALUES_EQUAL("", GetHost("")); |
| 28 | } |
| 29 | |
| 30 | Y_UNIT_TEST(TestGetSchemeHostAndPortWithoutSplit) { |
| 31 | UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetSchemeHostAndPort("ya.ru/bebe")); |
nothing calls this directly
no test coverage detected