aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/uri
diff options
context:
space:
mode:
authorsobols <sobols@yandex-team.ru>2022-02-10 16:47:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:08 +0300
commit09961b69c61f471ddd594e0fd877df62a8021562 (patch)
tree54a7b60a9526a7104557a033eb0a8d70d64b604c /library/cpp/uri
parent4ce8835206f981afa4a61915a49a21fb750416ec (diff)
downloadydb-09961b69c61f471ddd594e0fd877df62a8021562.tar.gz
Restoring authorship annotation for <sobols@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/uri')
-rw-r--r--library/cpp/uri/uri-ru_ut.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/library/cpp/uri/uri-ru_ut.cpp b/library/cpp/uri/uri-ru_ut.cpp
index ec35a164d2..3fca250dcf 100644
--- a/library/cpp/uri/uri-ru_ut.cpp
+++ b/library/cpp/uri/uri-ru_ut.cpp
@@ -4,15 +4,15 @@
#include <util/system/maxlen.h>
namespace NUri {
- namespace {
- TString AsWin1251(const TString& s) {
- return Recode(CODES_UTF8, CODES_WIN, s);
- }
- TString AsKoi8(const TString& s) {
- return Recode(CODES_UTF8, CODES_KOI8, s);
- }
- }
-
+ namespace {
+ TString AsWin1251(const TString& s) {
+ return Recode(CODES_UTF8, CODES_WIN, s);
+ }
+ TString AsKoi8(const TString& s) {
+ return Recode(CODES_UTF8, CODES_KOI8, s);
+ }
+ }
+
Y_UNIT_TEST_SUITE(URLTestRU) {
Y_UNIT_TEST(test_httpURL2) {
TUri url;
@@ -37,19 +37,19 @@ namespace NUri {
UNIT_ASSERT(!url.IsNull(TField::FlagPath));
UNIT_ASSERT_VALUES_EQUAL(url.PrintS(TField::FlagPath), "www.ya.ru/index.html");
- UNIT_ASSERT_VALUES_EQUAL(url.Parse(AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10")), TState::ParsedOK);
- UNIT_ASSERT_VALUES_EQUAL(url.PrintS(), AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10"));
+ UNIT_ASSERT_VALUES_EQUAL(url.Parse(AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10")), TState::ParsedOK);
+ UNIT_ASSERT_VALUES_EQUAL(url.PrintS(), AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10"));
- UNIT_ASSERT_VALUES_EQUAL(url.Parse(AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10"),
+ UNIT_ASSERT_VALUES_EQUAL(url.Parse(AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10"),
TFeature::FeaturesDefault | TFeature::FeatureEncodeExtendedASCII),
TState::ParsedOK);
UNIT_ASSERT_VALUES_EQUAL(url.PrintS(),
- AsWin1251("www.TEST.Ru/%D4%C5%D3%D4\\'\".html?%D4%C5%D3%D4\\'\"=%D4%C5%D3%D4+\\'\"%10"));
+ AsWin1251("www.TEST.Ru/%D4%C5%D3%D4\\'\".html?%D4%C5%D3%D4\\'\"=%D4%C5%D3%D4+\\'\"%10"));
- UNIT_ASSERT_VALUES_EQUAL(url.Parse(AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10"),
+ UNIT_ASSERT_VALUES_EQUAL(url.Parse(AsWin1251("www.TEST.Ru/ФЕУФ\\'\".html?ФЕУФ\\'\"=ФЕУФ+\\'\"%10"),
TFeature::FeaturesDefault | TFeature::FeatureEncodeForSQL),
TState::ParsedOK);
- UNIT_ASSERT_VALUES_EQUAL(url.PrintS(), AsWin1251("www.TEST.Ru/ФЕУФ%5C%27%22.html?ФЕУФ%5C%27%22=ФЕУФ+%5C%27%22%10"));
+ UNIT_ASSERT_VALUES_EQUAL(url.PrintS(), AsWin1251("www.TEST.Ru/ФЕУФ%5C%27%22.html?ФЕУФ%5C%27%22=ФЕУФ+%5C%27%22%10"));
UNIT_ASSERT_VALUES_EQUAL(url.Parse("q/%33%26%13%2f%2b%30%20",
TFeature::FeaturesDefault | TFeature::FeatureDecodeStandard),
@@ -62,7 +62,7 @@ namespace NUri {
UNIT_ASSERT_VALUES_EQUAL(url.Parse("//server/path", TFeature::FeaturesRobot), TState::ParsedOK);
}
- const TString links[] = {
+ const TString links[] = {
"viewforum.php?f=1&amp;sid=b4568481b67b1d7683bea78634b2e240", "viewforum.php?f=1&sid=b4568481b67b1d7683bea78634b2e240",
"./viewtopic.php?p=74&amp;sid=6#p74", "./viewtopic.php?p=74&sid=6#p74",
"viewtopic.php?p=9313&amp;sid=8#9313", "viewtopic.php?p=9313&sid=8#9313",
@@ -71,12 +71,12 @@ namespace NUri {
"images\nil.jpg", "images%0Ail.jpg",
"http://caedebaturque.termez.su\r\n/?article=218", "http://caedebaturque.termez.su%0D%0A/?article=218",
- AsKoi8("javascript:window.external.AddFavorite(\'http://www.humor.look.ru/\',\'Злобные Деды Морозы!!!\')"), "javascript:window.external.AddFavorite(\'http://www.humor.look.ru/\',\'%FA%CC%CF%C2%CE%D9%C5%20%E4%C5%C4%D9%20%ED%CF%D2%CF%DA%D9!!!\')",
+ AsKoi8("javascript:window.external.AddFavorite(\'http://www.humor.look.ru/\',\'Злобные Деды Морозы!!!\')"), "javascript:window.external.AddFavorite(\'http://www.humor.look.ru/\',\'%FA%CC%CF%C2%CE%D9%C5%20%E4%C5%C4%D9%20%ED%CF%D2%CF%DA%D9!!!\')",
"search.php?search_author=%CB%FE%E4%EC%E8%EB%E0+%C3%F3%F1%E5%E2%E0&amp;showresults=posts&amp;sid=8", "search.php?search_author=%CB%FE%E4%EC%E8%EB%E0+%C3%F3%F1%E5%E2%E0&showresults=posts&sid=8",
- AsWin1251("/Search/author/?q=Штрибель Х.В."), "/Search/author/?q=%D8%F2%F0%E8%E1%E5%EB%FC%20%D5.%C2.",
- AsWin1251("javascript:ins(\'ГОРШОК\')"), "javascript:ins(\'%C3%CE%D0%D8%CE%CA\')",
- AsWin1251("?l=я"), "?l=%FF",
- AsWin1251("content.php?id=3392&theme=Цена"), "content.php?id=3392&theme=%D6%E5%ED%E0",
+ AsWin1251("/Search/author/?q=Штрибель Х.В."), "/Search/author/?q=%D8%F2%F0%E8%E1%E5%EB%FC%20%D5.%C2.",
+ AsWin1251("javascript:ins(\'ГОРШОК\')"), "javascript:ins(\'%C3%CE%D0%D8%CE%CA\')",
+ AsWin1251("?l=я"), "?l=%FF",
+ AsWin1251("content.php?id=3392&theme=Цена"), "content.php?id=3392&theme=%D6%E5%ED%E0",
"/a-mp3/stype-1/?search=А", "/a-mp3/stype-1/?search=%D0%90",
"/a-mp3/stype-1/?search=Б", "/a-mp3/stype-1/?search=%D0%91",
"/a-mp3/stype-1/?search=В", "/a-mp3/stype-1/?search=%D0%92",
@@ -86,7 +86,7 @@ namespace NUri {
"/a-mp3/stype-1/?search=Ж", "/a-mp3/stype-1/?search=%D0%96",
"/a-mp3/stype-1/?search=З", "/a-mp3/stype-1/?search=%D0%97",
// %98 is not defined in CP1251 so don't put it here explicitly
- "/a-mp3/stype-1/?search=\xD0\x98", "/a-mp3/stype-1/?search=%D0%98",
+ "/a-mp3/stype-1/?search=\xD0\x98", "/a-mp3/stype-1/?search=%D0%98",
"/a-mp3/stype-1/?search=Й", "/a-mp3/stype-1/?search=%D0%99",
"/a-mp3/stype-1/?search=К", "/a-mp3/stype-1/?search=%D0%9A",
"/a-mp3/stype-1/?search=Л", "/a-mp3/stype-1/?search=%D0%9B",
@@ -94,7 +94,7 @@ namespace NUri {
"/a-mp3/stype-1/?search=Н", "/a-mp3/stype-1/?search=%D0%9D",
"/a-mp3/stype-1/?search=О", "/a-mp3/stype-1/?search=%D0%9E",
"/a-mp3/stype-1/?search=П", "/a-mp3/stype-1/?search=%D0%9F",
- "/a-mp3/stype-1/?search=\xD0", "/a-mp3/stype-1/?search=%D0",
+ "/a-mp3/stype-1/?search=\xD0", "/a-mp3/stype-1/?search=%D0",
"/a-mp3/stype-1/?search=С", "/a-mp3/stype-1/?search=%D0%A1",
"/a-mp3/stype-1/?search=Т", "/a-mp3/stype-1/?search=%D0%A2",
"/a-mp3/stype-1/?search=У", "/a-mp3/stype-1/?search=%D0%A3",
@@ -117,20 +117,20 @@ namespace NUri {
"http&#58;//www.is-ufa.ru/price2/price_IS.rar", "http://www.is-ufa.ru/price2/price_IS.rar",
"&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#105;&#110;&#102;&#111;&#64;&#101;&#116;&#101;&#109;&#46;&#100;&#101;", "mailto:info@etem.de",
"&quot;http://www.fubix.ru&quot;", "\"http://www.fubix.ru\"",
- 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",
- {}};
+ 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) {
char decodedlink[URL_MAXLEN + 10];
for (int i = 0; links[i]; i += 2) {
- UNIT_ASSERT(HtLinkDecode(links[i].c_str(), decodedlink, sizeof(decodedlink)));
- UNIT_ASSERT_VALUES_EQUAL(decodedlink, links[i + 1]);
+ UNIT_ASSERT(HtLinkDecode(links[i].c_str(), decodedlink, sizeof(decodedlink)));
+ UNIT_ASSERT_VALUES_EQUAL(decodedlink, links[i + 1]);
}
}
Y_UNIT_TEST(testRuIDNA) {
{
-#define DEC "\xD7\xE5\xF0\xE5\xEf\xEE\xE2\xE5\xF6.\xF0\xF4" /* "Череповец.рф" in Windows-1251 */
+#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"
// punycode corresponds to lowercase
#define PNC "xn--b1afab7bff7cb.xn--p1ai"