aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/uri
diff options
context:
space:
mode:
authoryazevnul <yazevnul@yandex-team.ru>2022-02-10 16:46:48 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:48 +0300
commit9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/uri
parent8cbc307de0221f84c80c42dcbe07d40727537e2c (diff)
downloadydb-9abfb1a53b7f7b791444d1378e645d8fad9b06ed.tar.gz
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/uri')
-rw-r--r--library/cpp/uri/location_ut.cpp16
-rw-r--r--library/cpp/uri/uri-ru_ut.cpp8
-rw-r--r--library/cpp/uri/uri_ut.cpp74
3 files changed, 49 insertions, 49 deletions
diff --git a/library/cpp/uri/location_ut.cpp b/library/cpp/uri/location_ut.cpp
index 9c997f41ac..26a0f64471 100644
--- a/library/cpp/uri/location_ut.cpp
+++ b/library/cpp/uri/location_ut.cpp
@@ -2,36 +2,36 @@
#include <library/cpp/testing/unittest/registar.h>
-Y_UNIT_TEST_SUITE(TResolveRedirectTests) {
- Y_UNIT_TEST(Absolute) {
+Y_UNIT_TEST_SUITE(TResolveRedirectTests) {
+ Y_UNIT_TEST(Absolute) {
UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "http://redir-example.com/sub"), "http://redir-example.com/sub");
}
- Y_UNIT_TEST(AbsWithFragment) {
+ Y_UNIT_TEST(AbsWithFragment) {
UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "http://redir-example.com/sub#Hello"), "http://redir-example.com/sub#Hello");
UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com/#Hello", "http://redir-example.com/sub"), "http://redir-example.com/sub#Hello");
}
- Y_UNIT_TEST(Rel) {
+ Y_UNIT_TEST(Rel) {
UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "/sub"), "http://example.com/sub");
}
- Y_UNIT_TEST(RelWithFragment) {
+ Y_UNIT_TEST(RelWithFragment) {
UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "/sub#Hello"), "http://example.com/sub#Hello");
UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com/#Hello", "/sub"), "http://example.com/sub#Hello");
}
- Y_UNIT_TEST(WrongLocation) {
+ Y_UNIT_TEST(WrongLocation) {
UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", ""), "");
}
- Y_UNIT_TEST(WrongBase) {
+ Y_UNIT_TEST(WrongBase) {
UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("", "http://example.com"), "");
}
- Y_UNIT_TEST(HashBangIsNothingSpecial) {
+ Y_UNIT_TEST(HashBangIsNothingSpecial) {
UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "http://redir-example.com/sub#!Hello"), "http://redir-example.com/sub#!Hello");
UNIT_ASSERT_EQUAL(
diff --git a/library/cpp/uri/uri-ru_ut.cpp b/library/cpp/uri/uri-ru_ut.cpp
index ac5b19160d..ec35a164d2 100644
--- a/library/cpp/uri/uri-ru_ut.cpp
+++ b/library/cpp/uri/uri-ru_ut.cpp
@@ -13,8 +13,8 @@ namespace NUri {
}
}
- Y_UNIT_TEST_SUITE(URLTestRU) {
- Y_UNIT_TEST(test_httpURL2) {
+ Y_UNIT_TEST_SUITE(URLTestRU) {
+ Y_UNIT_TEST(test_httpURL2) {
TUri url;
UNIT_ASSERT_VALUES_EQUAL(url.Parse("g:h"), TState::ParsedBadScheme);
UNIT_ASSERT_VALUES_EQUAL(url.Parse("http:g"), TState::ParsedBadFormat);
@@ -120,7 +120,7 @@ namespace NUri {
AsWin1251("mailto:&#107;&#97;&#109;&#112;&#97;&#64;&#117;&#107;&#114;&#46;&#110;&#101;&#116;?subject=Арабский язык"), "mailto:kampa@ukr.net?subject=%C0%F0%E0%E1%F1%EA%E8%E9%20%FF%E7%FB%EA",
{}};
- Y_UNIT_TEST(testHtLinkDecode) {
+ Y_UNIT_TEST(testHtLinkDecode) {
char decodedlink[URL_MAXLEN + 10];
for (int i = 0; links[i]; i += 2) {
UNIT_ASSERT(HtLinkDecode(links[i].c_str(), decodedlink, sizeof(decodedlink)));
@@ -128,7 +128,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(testRuIDNA) {
+ Y_UNIT_TEST(testRuIDNA) {
{
#define DEC "\xD7\xE5\xF0\xE5\xEf\xEE\xE2\xE5\xF6.\xF0\xF4" /* "Череповец.рф" in Windows-1251 */
#define ENC "%D7%E5%F0%E5%EF%EE%E2%E5%F6.%F0%F4"
diff --git a/library/cpp/uri/uri_ut.cpp b/library/cpp/uri/uri_ut.cpp
index 852356ac26..2ebd83fc93 100644
--- a/library/cpp/uri/uri_ut.cpp
+++ b/library/cpp/uri/uri_ut.cpp
@@ -6,7 +6,7 @@
#include <util/system/maxlen.h>
namespace NUri {
- Y_UNIT_TEST_SUITE(URLTest) {
+ Y_UNIT_TEST_SUITE(URLTest) {
static const char* urls[] = {
"http://a/b/c/d;p?q#r",
"g", "http://a/b/c/g",
@@ -60,7 +60,7 @@ namespace NUri {
// "%2zy", "http://a/b/c/%2zy",
nullptr};
- Y_UNIT_TEST(test_httpURL) {
+ Y_UNIT_TEST(test_httpURL) {
TUri rel, base, abs;
TState::EParsed er = base.Parse(urls[0]);
UNIT_ASSERT_VALUES_EQUAL(er, TState::ParsedOK);
@@ -91,7 +91,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(test_Schemes) {
+ Y_UNIT_TEST(test_Schemes) {
TUri url;
UNIT_ASSERT_VALUES_EQUAL(url.Parse("www.ya.ru/index.html"), TState::ParsedOK);
UNIT_ASSERT_EQUAL(url.GetScheme(), TScheme::SchemeEmpty);
@@ -128,7 +128,7 @@ namespace NUri {
{nullptr, nullptr, nullptr, TUri::LinkIsBad},
};
- Y_UNIT_TEST(test_httpURLNormalize) {
+ Y_UNIT_TEST(test_httpURLNormalize) {
TUri normalizedLink;
for (int i = 0; link4Norm[i].link; i++) {
@@ -149,7 +149,7 @@ namespace NUri {
"http://a/b//c", "http://a/b/c",
nullptr, nullptr};
- Y_UNIT_TEST(test_httpURLPathOperation) {
+ Y_UNIT_TEST(test_httpURLPathOperation) {
char copyUrl[URL_MAXLEN];
for (int i = 0; urlsWithMultipleSlash[i]; i += 2) {
const TStringBuf url(urlsWithMultipleSlash[i]);
@@ -187,14 +187,14 @@ namespace NUri {
TState::ParsedBadHost,
};
- Y_UNIT_TEST(test_httpURLCheckHost) {
+ Y_UNIT_TEST(test_httpURLCheckHost) {
for (size_t index = 0; hostsForCheckHost[index]; ++index) {
TState::EParsed state = TUri::CheckHost(hostsForCheckHost[index]);
UNIT_ASSERT_VALUES_EQUAL(state, answersForCheckHost[index]);
}
}
- Y_UNIT_TEST(test_httpURLSet) {
+ Y_UNIT_TEST(test_httpURLSet) {
// set port
{
TUri parsedUrl;
@@ -232,7 +232,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(test_httpURLAuth) {
+ Y_UNIT_TEST(test_httpURLAuth) {
{
TUri parsedUrl;
TState::EParsed st = parsedUrl.Parse("http://@www.host.com/path", TFeature::FeaturesRobot);
@@ -258,28 +258,28 @@ namespace NUri {
}
}
- Y_UNIT_TEST(test01) {
+ Y_UNIT_TEST(test01) {
TTest test = {
"user:pass@host:8080", TFeature::FeaturesAll, TState::ParsedRootless, "user", "", "", "", 0, "", "", ""};
TUri url;
URL_TEST(url, test);
}
- Y_UNIT_TEST(test02) {
+ Y_UNIT_TEST(test02) {
TTest test = {
"http://host", TFeature::FeaturesAll, TState::ParsedOK, "http", "", "", "host", 80, "/", "", ""};
TUri url;
URL_TEST(url, test);
}
- Y_UNIT_TEST(test03) {
+ Y_UNIT_TEST(test03) {
TTest test = {
"https://host", TFeature::FeatureSchemeFlexible | TFeature::FeatureAllowHostIDN, TState::ParsedOK, "https", "", "", "host", 443, "/", "", ""};
TUri url;
URL_TEST(url, test);
}
- Y_UNIT_TEST(test04) {
+ Y_UNIT_TEST(test04) {
TTest test = {
"user:pass@host:8080", TFeature::FeaturesAll | TFeature::FeatureNoRelPath | TFeature::FeatureAllowRootless, TState::ParsedOK, "user", "", "", "", 0, "pass@host:8080", "", ""};
TUri url;
@@ -289,7 +289,7 @@ namespace NUri {
URL_EQ(url, url2);
}
- Y_UNIT_TEST(test05) {
+ Y_UNIT_TEST(test05) {
TTest test = {
"host:8080", TFeature::FeaturesAll | TFeature::FeatureNoRelPath | TFeature::FeatureAllowRootless, TState::ParsedOK, "host", "", "", "", 0, "8080", "", ""};
TUri url;
@@ -297,7 +297,7 @@ namespace NUri {
UNIT_ASSERT_VALUES_EQUAL(url.PrintS(), "host:8080");
}
- Y_UNIT_TEST(test06) {
+ Y_UNIT_TEST(test06) {
TTest test = {
"http://user:pass@host?q", TFeature::FeaturesAll, TState::ParsedOK, "http", "user", "pass", "host", 80, "/", "q", ""};
TUri url;
@@ -359,7 +359,7 @@ namespace NUri {
URL_EQ(url, url2);
}
- Y_UNIT_TEST(test07) {
+ Y_UNIT_TEST(test07) {
{
TTest test = {
"http://host/path//", TFeature::FeaturesAll | TFeature::FeatureNoRelPath, TState::ParsedOK, "http", "", "", "host", 80, "/path/", "", ""};
@@ -385,7 +385,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(test08) {
+ Y_UNIT_TEST(test08) {
{
TTest test = {
"mailto://user@host.com", TFeature::FeaturesAll | TFeature::FeatureNoRelPath, TState::ParsedOK, "mailto", "user", "", "host.com", 0, "", "", ""};
@@ -472,7 +472,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(test09) {
+ Y_UNIT_TEST(test09) {
{
TTest test = {
"mailto:user@host.com", TFeature::FeaturesAll | TFeature::FeatureAllowRootless, TState::ParsedOK, "mailto", "", "", "", 0, "user@host.com", "", ""};
@@ -493,7 +493,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(test10) {
+ Y_UNIT_TEST(test10) {
// test some escaping madness, note the ehost vs host
{
TString host = "президент.рф";
@@ -553,7 +553,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(test11) {
+ Y_UNIT_TEST(test11) {
{
TTest test = {
"HtTp://HoSt/%50aTh/?Query#Frag", TFeature::FeaturesAll | TFeature::FeatureNoRelPath, TState::ParsedOK, "http", "", "", "host", 80, "/PaTh/", "Query", "Frag"};
@@ -569,7 +569,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(test12) {
+ Y_UNIT_TEST(test12) {
// test characters which are not always safe
{
#define RAW "/:"
@@ -666,7 +666,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(testFlexibleAuthority) {
+ Y_UNIT_TEST(testFlexibleAuthority) {
TUri uri;
UNIT_ASSERT_EQUAL(uri.Parse("http://hello_world", TFeature::FeatureCheckHost), TState::ParsedBadHost);
UNIT_ASSERT_EQUAL(uri.Parse("http://hello_world", TFeature::FeatureSchemeFlexible), TState::ParsedOK);
@@ -683,7 +683,7 @@ namespace NUri {
UNIT_ASSERT_VALUES_EQUAL(uri.GetField(TField::FieldQuery), "");
}
- Y_UNIT_TEST(testSpecialChar) {
+ Y_UNIT_TEST(testSpecialChar) {
// test characters which are not always allowed
{
TTest test = {
@@ -729,7 +729,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(testIPv6) {
+ Y_UNIT_TEST(testIPv6) {
{
#define RAW "[1080:0:0:0:8:800:200C:417A]"
#define DEC "[1080:0:0:0:8:800:200c:417a]"
@@ -743,7 +743,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(testEscapedFragment) {
+ Y_UNIT_TEST(testEscapedFragment) {
{
TTest test = {
"http://host.com#!a=b&c=d#e+g%41%25", TParseFlags(TFeature::FeaturesAll | TFeature::FeatureHashBangToEscapedFragment), TState::ParsedOK, "http", "", "", "host.com", 80, "/", "_escaped_fragment_=a=b%26c=d%23e%2BgA%2525", ""};
@@ -760,7 +760,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(testReEncode) {
+ Y_UNIT_TEST(testReEncode) {
{
TStringStream out;
TUri::ReEncode(out, "foo bar");
@@ -782,7 +782,7 @@ namespace NUri {
"http://translate.yandex.net/api/v1/tr.json/translate?lang=en-ru&text=>",
nullptr};
- Y_UNIT_TEST(test_NonRfcUrls) {
+ Y_UNIT_TEST(test_NonRfcUrls) {
TUri url;
const long flags = TFeature::FeaturesRobot;
for (size_t i = 0;; ++i) {
@@ -797,7 +797,7 @@ namespace NUri {
"http://www.'>'.com/?.net/",
nullptr};
- Y_UNIT_TEST(test_CheckParseException) {
+ Y_UNIT_TEST(test_CheckParseException) {
TUri url;
const long flags = TFeature::FeaturesRobot | TFeature::FeaturesEncode;
for (size_t i = 0;; ++i) {
@@ -818,7 +818,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(test_PrintPort) {
+ Y_UNIT_TEST(test_PrintPort) {
TUri uri;
{
uri.Parse("http://srv.net:9100/print", TFeature::FeaturesRecommended);
@@ -834,7 +834,7 @@ namespace NUri {
}
}
- Y_UNIT_TEST(test_ParseFailures) {
+ Y_UNIT_TEST(test_ParseFailures) {
{
TTest test = {
"http://host:port", TFeature::FeaturesAll | TFeature::FeatureNoRelPath, TState::ParsedBadFormat, "", "", "", "", Max<ui16>(), "", "", ""};
@@ -901,8 +901,8 @@ namespace NUri {
}
}
- Y_UNIT_TEST_SUITE(TInvertDomainTest) {
- Y_UNIT_TEST(TestInvert) {
+ Y_UNIT_TEST_SUITE(TInvertDomainTest) {
+ Y_UNIT_TEST(TestInvert) {
TString a;
UNIT_ASSERT_EQUAL(InvertDomain(a), "");
TString aa(".:/foo");
@@ -954,8 +954,8 @@ namespace NUri {
return r;
}
- Y_UNIT_TEST_SUITE(QargsTest) {
- Y_UNIT_TEST(TestSorting) {
+ Y_UNIT_TEST_SUITE(QargsTest) {
+ Y_UNIT_TEST(TestSorting) {
UNIT_ASSERT_STRINGS_EQUAL(SortQargs("http://ya.ru/"), "http://ya.ru/");
UNIT_ASSERT_STRINGS_EQUAL(SortQargs("http://ya.ru/?"), "http://ya.ru/?");
UNIT_ASSERT_STRINGS_EQUAL(SortQargs("http://ya.ru/?some=value"), "http://ya.ru/?some=value");
@@ -973,7 +973,7 @@ namespace NUri {
UNIT_ASSERT_STRINGS_EQUAL(SortQargs("http://ya.ru/?b==&a=&&c="), "http://ya.ru/?a=&b==&c=");
}
- Y_UNIT_TEST(TestParsingCorners) {
+ Y_UNIT_TEST(TestParsingCorners) {
TString s;
UNIT_ASSERT_EQUAL(ProcessQargs("http://ya.ru/?=", s), TQueryArg::ProcessedOK);
@@ -992,14 +992,14 @@ namespace NUri {
UNIT_ASSERT_STRINGS_EQUAL(SortQargs("http://ya.ru/?a"), "http://ya.ru/?a");
}
- Y_UNIT_TEST(TestFiltering) {
+ Y_UNIT_TEST(TestFiltering) {
UNIT_ASSERT_STRINGS_EQUAL(FilterQargs("http://ya.ru/?some=value", "missing"), "http://ya.ru/?some=value");
UNIT_ASSERT_STRINGS_EQUAL(FilterQargs("http://ya.ru/?b=1&a=2", "b"), "http://ya.ru/?a=2");
UNIT_ASSERT_STRINGS_EQUAL(FilterQargs("http://ya.ru/?b=1&a=2&a=3", "a"), "http://ya.ru/?b=1");
UNIT_ASSERT_STRINGS_EQUAL(FilterQargs("http://ya.ru/?some=&another=", "another"), "http://ya.ru/?some=");
}
- Y_UNIT_TEST(TestRemoveEmptyFeature) {
+ Y_UNIT_TEST(TestRemoveEmptyFeature) {
TUri uri;
uri.Parse("http://ya.ru/?", NUri::TFeature::FeaturesRecommended);
@@ -1009,7 +1009,7 @@ namespace NUri {
UNIT_ASSERT_STRINGS_EQUAL(uri.PrintS(), "http://ya.ru/");
}
- Y_UNIT_TEST(TestNoRemoveEmptyFeature) {
+ Y_UNIT_TEST(TestNoRemoveEmptyFeature) {
TUri uri;
uri.Parse("http://ya.ru/?", NUri::TFeature::FeaturesRecommended);