commit - b2003598163139e77b0c57b831c78ef8adeb5118
commit + ac07537e50ff7dce0e15a73d32c693c631c42844
blob - 2dd66474221c65f42ae309860b37b772d385120f
blob + 66a56b52d0b63ea301809a6d755c51735d4ce05c
--- tests/test_parse_url.cc
+++ tests/test_parse_url.cc
TEST_START(test_parse_url)
zs_url_path_t zs_url_path;
- IS_TRUE(parse_url(cut_null("gemini://host"), zs_url_path) == url_ok);
- IS_TRUE(strcmp(zs_url_path.begin(), "") == 0);
+ IS_TRUE(parse_url(cut_null("gemini://host"), zs_url_path) == url_ok
+ && strcmp(zs_url_path.begin(), "") == 0);
- IS_TRUE(parse_url(cut_null("gemini://host/"), zs_url_path) == url_ok);
- IS_TRUE(strcmp(zs_url_path.begin(), "") == 0);
+ IS_TRUE(parse_url(cut_null("gemini://host/"), zs_url_path) == url_ok
+ && strcmp(zs_url_path.begin(), "") == 0);
- IS_TRUE(parse_url(cut_null("gemini://host/a"), zs_url_path) == url_ok);
- IS_TRUE(strcmp(zs_url_path.begin(), "a") == 0);
+ IS_TRUE(parse_url(cut_null("gemini://host/a"), zs_url_path) == url_ok
+ && strcmp(zs_url_path.begin(), "a") == 0);
- IS_TRUE(parse_url(cut_null("gemini://host/a/b"), zs_url_path) == url_ok);
- IS_TRUE(strcmp(zs_url_path.begin(), "a/b") == 0);
+ IS_TRUE(parse_url(cut_null("gemini://host/a/b"), zs_url_path) == url_ok
+ && strcmp(zs_url_path.begin(), "a/b") == 0);
- IS_TRUE(parse_url(cut_null("gemini://host:port"), zs_url_path) == url_ok);
- IS_TRUE(strcmp(zs_url_path.begin(), "") == 0);
+ IS_TRUE(parse_url(cut_null("gemini://host:port"), zs_url_path) == url_ok
+ && strcmp(zs_url_path.begin(), "") == 0);
- IS_TRUE(parse_url(cut_null("gemini://host:port/"), zs_url_path) == url_ok);
- IS_TRUE(strcmp(zs_url_path.begin(), "") == 0);
+ IS_TRUE(parse_url(cut_null("gemini://host:port/"), zs_url_path) == url_ok
+ && strcmp(zs_url_path.begin(), "") == 0);
- IS_TRUE(parse_url(cut_null("gemini://host:port/a"), zs_url_path) == url_ok);
- IS_TRUE(strcmp(zs_url_path.begin(), "a") == 0);
+ IS_TRUE(parse_url(cut_null("gemini://host:port/a"), zs_url_path) == url_ok
+ && strcmp(zs_url_path.begin(), "a") == 0);
- IS_TRUE(parse_url(cut_null("gemini://host:port/a/b"), zs_url_path) == url_ok);
- IS_TRUE(strcmp(zs_url_path.begin(), "a/b") == 0);
+ IS_TRUE(parse_url(cut_null("gemini://host:port/a/b"), zs_url_path) == url_ok
+ && strcmp(zs_url_path.begin(), "a/b") == 0);
IS_TRUE(parse_url(cut_null(""), zs_url_path) == url_too_short);
IS_TRUE(parse_url(cut_null("g"), zs_url_path) == url_too_short);
IS_TRUE(parse_url(cut_null("gemini://host/../secret.txt"), zs_url_path) == url_root_traverse);
IS_TRUE(parse_url(cut_null("gemini://host/dir/../../secret.txt"), zs_url_path) == url_root_traverse);
- IS_TRUE(parse_url(cut_null("gemini://host/a/b/../c/./d"), zs_url_path) == url_ok);
- IS_TRUE(strcmp(zs_url_path.begin(), "a/c/d") == 0);
+ IS_TRUE(parse_url(cut_null("gemini://host/a/b/../c/./d"), zs_url_path) == url_ok
+ && strcmp(zs_url_path.begin(), "a/c/d") == 0);
+
+ // RFC 3986, 3.1. Scheme
+ // > ... An implementation
+ // > should accept uppercase letters as equivalent to lowercase in scheme
+ // > names (e.g., allow "HTTP" as well as "http")
+ IS_TRUE(parse_url(cut_null("GeMiNi://host"), zs_url_path) == url_ok
+ && strcmp(zs_url_path.begin(), "") == 0);
TEST_END()
} // namespace vostok