diff options
author | Vlad Yaroslavlev <vladon@vladon.com> | 2022-02-10 16:46:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:23 +0300 |
commit | 706b83ed7de5a473436620367af31fc0ceecde07 (patch) | |
tree | 103305d30dec77e8f6367753367f59b3cd68f9f1 /library/cpp/getopt | |
parent | 918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff) | |
download | ydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz |
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/getopt')
-rw-r--r-- | library/cpp/getopt/print.cpp | 4 | ||||
-rw-r--r-- | library/cpp/getopt/small/last_getopt_opt.h | 2 | ||||
-rw-r--r-- | library/cpp/getopt/small/last_getopt_opts.cpp | 4 | ||||
-rw-r--r-- | library/cpp/getopt/small/last_getopt_parser.cpp | 2 | ||||
-rw-r--r-- | library/cpp/getopt/small/last_getopt_support.h | 2 | ||||
-rw-r--r-- | library/cpp/getopt/small/modchooser.cpp | 8 | ||||
-rw-r--r-- | library/cpp/getopt/small/modchooser.h | 20 | ||||
-rw-r--r-- | library/cpp/getopt/small/opt.h | 2 | ||||
-rw-r--r-- | library/cpp/getopt/small/opt2.cpp | 4 | ||||
-rw-r--r-- | library/cpp/getopt/small/opt2.h | 16 | ||||
-rw-r--r-- | library/cpp/getopt/small/ygetopt.cpp | 12 | ||||
-rw-r--r-- | library/cpp/getopt/ut/last_getopt_ut.cpp | 92 | ||||
-rw-r--r-- | library/cpp/getopt/ut/opt_ut.cpp | 4 | ||||
-rw-r--r-- | library/cpp/getopt/ut/posix_getopt_ut.cpp | 4 | ||||
-rw-r--r-- | library/cpp/getopt/ut/ygetopt_ut.cpp | 4 |
15 files changed, 90 insertions, 90 deletions
diff --git a/library/cpp/getopt/print.cpp b/library/cpp/getopt/print.cpp index 8cf1c62e4d..57c244f333 100644 --- a/library/cpp/getopt/print.cpp +++ b/library/cpp/getopt/print.cpp @@ -10,7 +10,7 @@ #include <library/cpp/build_info/build_info.h> namespace NLastGetoptPrivate { - TString InitVersionString() { + TString InitVersionString() { TString ts = GetProgramSvnVersion(); ts += "\n"; ts += GetBuildInfo(); @@ -27,7 +27,7 @@ namespace NLastGetoptPrivate { return ts; } - TString& VersionString(); + TString& VersionString(); TString& ShortVersionString(); struct TInit { diff --git a/library/cpp/getopt/small/last_getopt_opt.h b/library/cpp/getopt/small/last_getopt_opt.h index a8dd5adca9..fe6c2c064d 100644 --- a/library/cpp/getopt/small/last_getopt_opt.h +++ b/library/cpp/getopt/small/last_getopt_opt.h @@ -5,7 +5,7 @@ #include <util/string/split.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/maybe.h> #include <util/generic/vector.h> #include <util/string/cast.h> diff --git a/library/cpp/getopt/small/last_getopt_opts.cpp b/library/cpp/getopt/small/last_getopt_opts.cpp index 03c432849f..13c327af12 100644 --- a/library/cpp/getopt/small/last_getopt_opts.cpp +++ b/library/cpp/getopt/small/last_getopt_opts.cpp @@ -11,8 +11,8 @@ #include <stdlib.h> namespace NLastGetoptPrivate { - TString& VersionString() { - static TString data; + TString& VersionString() { + static TString data; return data; } TString& ShortVersionString() { diff --git a/library/cpp/getopt/small/last_getopt_parser.cpp b/library/cpp/getopt/small/last_getopt_parser.cpp index 7668b12a03..cf04841fd4 100644 --- a/library/cpp/getopt/small/last_getopt_parser.cpp +++ b/library/cpp/getopt/small/last_getopt_parser.cpp @@ -124,7 +124,7 @@ namespace NLastGetopt { if (opt->GetHasArg() == NO_ARGUMENT) { return Commit(opt, nullptr, pos, p); } - return Commit(opt, arg.SubStr(p), pos + 1, 0); + return Commit(opt, arg.SubStr(p), pos + 1, 0); } bool TOptsParser::ParseShortOptArg(size_t pos) { diff --git a/library/cpp/getopt/small/last_getopt_support.h b/library/cpp/getopt/small/last_getopt_support.h index 17bed3e614..72474578c5 100644 --- a/library/cpp/getopt/small/last_getopt_support.h +++ b/library/cpp/getopt/small/last_getopt_support.h @@ -1,7 +1,7 @@ #pragma once #include <util/string/cast.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/utility.h> #include <util/generic/yexception.h> diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp index 2fa5cfd070..f6e091fb2d 100644 --- a/library/cpp/getopt/small/modchooser.cpp +++ b/library/cpp/getopt/small/modchooser.cpp @@ -128,11 +128,11 @@ void TModChooser::AddAlias(const TString& alias, const TString& mode) { Modes[alias] = Modes[mode]; } -void TModChooser::SetDescription(const TString& descr) { +void TModChooser::SetDescription(const TString& descr) { Description = descr; } -void TModChooser::SetModesHelpOption(const TString& helpOption) { +void TModChooser::SetModesHelpOption(const TString& helpOption) { ModesHelpOption = helpOption; } @@ -144,7 +144,7 @@ void TModChooser::SetSeparatedMode(bool separated) { ShowSeparated = separated; } -void TModChooser::SetSeparationString(const TString& str) { +void TModChooser::SetSeparationString(const TString& str) { SeparationString = str; } @@ -277,7 +277,7 @@ TString TModChooser::TMode::FormatFullName(size_t pad) const { return name; } -void TModChooser::PrintHelp(const TString& progName) const { +void TModChooser::PrintHelp(const TString& progName) const { Cerr << Description << Endl << Endl; Cerr << NColorizer::StdErr().BoldColor() << "Usage" << NColorizer::StdErr().OldColor() << ": " << progName << " MODE [MODE_OPTIONS]" << Endl; Cerr << Endl; diff --git a/library/cpp/getopt/small/modchooser.h b/library/cpp/getopt/small/modchooser.h index 0a8de6d50b..656e007489 100644 --- a/library/cpp/getopt/small/modchooser.h +++ b/library/cpp/getopt/small/modchooser.h @@ -3,7 +3,7 @@ #include "last_getopt_opts.h" #include <util/generic/map.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <functional> @@ -63,10 +63,10 @@ public: void AddAlias(const TString& alias, const TString& mode); //! Set main program description. - void SetDescription(const TString& descr); + void SetDescription(const TString& descr); //! Set modes help option name (-? is by default) - void SetModesHelpOption(const TString& helpOption); + void SetModesHelpOption(const TString& helpOption); //! Specify handler for '--version' parameter void SetVersionHandler(TVersionHandlerPtr handler); @@ -75,7 +75,7 @@ public: void SetSeparatedMode(bool separated = true); //! Set separation string - void SetSeparationString(const TString& str); + void SetSeparationString(const TString& str); //! Set short command representation in Usage block void SetPrintShortCommandInUsage(bool printShortCommandInUsage); @@ -100,12 +100,12 @@ public: //! Run appropriate mode. Same as Run(const int, const char**) int Run(const TVector<TString>& argv) const; - void PrintHelp(const TString& progName) const; + void PrintHelp(const TString& progName) const; struct TMode { - TString Name; + TString Name; TMainClass* Main; - TString Description; + TString Description; bool Hidden; bool NoCompletion; TVector<TString> Aliases; @@ -136,10 +136,10 @@ public: private: //! Main program description. - TString Description; + TString Description; //! Help option for modes. - TString ModesHelpOption; + TString ModesHelpOption; //! Wrappers around all modes. TVector<THolder<TMainClass>> Wrappers; @@ -162,7 +162,7 @@ private: bool PrintShortCommandInUsage; //! Text string used when displaying each separator - TString SeparationString; + TString SeparationString; //! Unsorted list of options TVector<THolder<TMode>> UnsortedModes; diff --git a/library/cpp/getopt/small/opt.h b/library/cpp/getopt/small/opt.h index ecb57439bc..b18f06d6e0 100644 --- a/library/cpp/getopt/small/opt.h +++ b/library/cpp/getopt/small/opt.h @@ -93,7 +93,7 @@ public: return Arg; } - TVector<TString> GetFreeArgs() const { + TVector<TString> GetFreeArgs() const { return NLastGetopt::TOptsParseResult(&*Opts_, GetArgC(), GetArgV()).GetFreeArgs(); } diff --git a/library/cpp/getopt/small/opt2.cpp b/library/cpp/getopt/small/opt2.cpp index 0cdc774e78..2816aef7a5 100644 --- a/library/cpp/getopt/small/opt2.cpp +++ b/library/cpp/getopt/small/opt2.cpp @@ -57,7 +57,7 @@ void Opt2::EatArgv(const char* optspec, const char* long_alias) { // long_alias has a form "long-name1=A,long-name2=B", etc. // This implementation is limited to aliasing a single long option // with single short option (extend it if you really need). - THashMap<const char*, char> long2short; + THashMap<const char*, char> long2short; long2short["help"] = '?'; long_alias = long_alias ? long_alias : ""; alias_copy = long_alias; @@ -105,7 +105,7 @@ void Opt2::EatArgv(const char* optspec, const char* long_alias) { } // long option always spans one argv (--switch or --option-name=value) const char* eq = strchr(s, '='); - TString lname(s, eq ? (size_t)(eq - s) : (size_t)strlen(s)); + TString lname(s, eq ? (size_t)(eq - s) : (size_t)strlen(s)); THashMap<const char*, char>::iterator i = long2short.find(lname.data()); if (i == long2short.end()) { UnknownLongOption = strdup(lname.data()); // free'd in AutoUsage() diff --git a/library/cpp/getopt/small/opt2.h b/library/cpp/getopt/small/opt2.h index 4d9d943237..70b2701122 100644 --- a/library/cpp/getopt/small/opt2.h +++ b/library/cpp/getopt/small/opt2.h @@ -1,7 +1,7 @@ #pragma once #include <util/system/defaults.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> // simplified options parser @@ -31,9 +31,9 @@ struct Opt2Param { bool IsRequired; bool MultipleUse; const char* DefValue; - TString DefValueStr; - TString HelpUsage; - TVector<const char*> ActualValue; + TString DefValueStr; + TString HelpUsage; + TVector<const char*> ActualValue; const char* LongOptName; Opt2Param() : HasArg(false) @@ -112,7 +112,7 @@ public: public: // non-option args - TVector<char*> Pos; + TVector<char*> Pos; bool HasErrors; private: @@ -122,15 +122,15 @@ private: char OptionMissingArg; char OptionWrongArg; char RequiredOptionMissing; - TVector<TString> UserErrorMessages; + TVector<TString> UserErrorMessages; protected: int Argc; char* const* Argv; int MinArgs, MaxArgs; ui8 SpecsMap[256]; - TVector<Opt2Param> Specs; - TString alias_copy; + TVector<Opt2Param> Specs; + TString alias_copy; void EatArgv(const char* optspec, const char* long_alias); void Clear(); Opt2Param& GetInternal(char opt, const char* defValue, const char* helpUsage, bool required); diff --git a/library/cpp/getopt/small/ygetopt.cpp b/library/cpp/getopt/small/ygetopt.cpp index 1f52827f74..f11e39588e 100644 --- a/library/cpp/getopt/small/ygetopt.cpp +++ b/library/cpp/getopt/small/ygetopt.cpp @@ -1,7 +1,7 @@ #include "opt.h" #include "ygetopt.h" -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/yexception.h> @@ -67,7 +67,7 @@ private: const char* Arg_; }; -TGetOpt::TIterator::TIterator() noexcept +TGetOpt::TIterator::TIterator() noexcept : Impl_(nullptr) { } @@ -82,11 +82,11 @@ void TGetOpt::TIterator::Next() { Impl_->Next(); } -char TGetOpt::TIterator::Key() const noexcept { +char TGetOpt::TIterator::Key() const noexcept { return Impl_->Key(); } -bool TGetOpt::TIterator::AtEnd() const noexcept { +bool TGetOpt::TIterator::AtEnd() const noexcept { if (Impl_.Get()) { return Impl_->AtEnd(); } @@ -94,7 +94,7 @@ bool TGetOpt::TIterator::AtEnd() const noexcept { return true; } -const char* TGetOpt::TIterator::Arg() const noexcept { +const char* TGetOpt::TIterator::Arg() const noexcept { if (Impl_.Get()) { return Impl_->Arg(); } @@ -102,7 +102,7 @@ const char* TGetOpt::TIterator::Arg() const noexcept { return nullptr; } -TGetOpt::TGetOpt(int argc, const char* const* argv, const TString& format) +TGetOpt::TGetOpt(int argc, const char* const* argv, const TString& format) : Impl_(new TImpl(argc, argv, format)) { } diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp index c99a1d053d..d35a493021 100644 --- a/library/cpp/getopt/ut/last_getopt_ut.cpp +++ b/library/cpp/getopt/ut/last_getopt_ut.cpp @@ -19,22 +19,22 @@ namespace { }; class TOptsParseResultTestWrapper: public TOptsParseResultException { - TVector<const char*> Argv_; + TVector<const char*> Argv_; public: - TOptsParseResultTestWrapper(const TOpts* opts, TVector<const char*> argv) + TOptsParseResultTestWrapper(const TOpts* opts, TVector<const char*> argv) : Argv_(argv) { Init(opts, (int)Argv_.size(), Argv_.data()); } }; - using V = TVector<const char*>; + using V = TVector<const char*>; } struct TOptsParserTester { TOptsNoDefault Opts_; - TVector<const char*> Argv_; + TVector<const char*> Argv_; THolder<TOptsParser> Parser_; @@ -58,13 +58,13 @@ struct TOptsParserTester { UNIT_ASSERT(Parser_->CurOpt()->CharIs(c)); } - void AcceptOption(const TString& optName) { + void AcceptOption(const TString& optName) { AcceptOption(); UNIT_ASSERT(Parser_->CurOpt()->NameIs(optName)); } template <typename TOpt> - void AcceptOptionWithValue(TOpt optName, const TString& value) { + void AcceptOptionWithValue(TOpt optName, const TString& value) { AcceptOption(optName); UNIT_ASSERT_VALUES_EQUAL_C(value, Parser_->CurValStr(), "; option " << optName); } @@ -75,7 +75,7 @@ struct TOptsParserTester { UNIT_ASSERT_C(!Parser_->CurVal(), ": opt " << optName << " must have no param"); } - void AcceptFreeArgInOrder(const TString& expected) { + void AcceptFreeArgInOrder(const TString& expected) { Accept(); UNIT_ASSERT(!Parser_->CurOpt()); UNIT_ASSERT_VALUES_EQUAL(expected, Parser_->CurValStr()); @@ -114,7 +114,7 @@ struct TOptsParserTester { UNIT_ASSERT_VALUES_EQUAL(sop, Parser_->Sop_); } - void AcceptFreeArg(const TString& expected) { + void AcceptFreeArg(const TString& expected) { UNIT_ASSERT(Pos_ < Parser_->Argc_); UNIT_ASSERT_VALUES_EQUAL(expected, Parser_->Argv_[Pos_]); ++Pos_; @@ -417,7 +417,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { Y_UNIT_TEST(TestStoreResult) { TOptsNoDefault opts; - TString data; + TString data; int number; TMaybe<TString> optionalString0, optionalString1; TMaybe<int> optionalNumber0, optionalNumber1; @@ -483,10 +483,10 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { Y_UNIT_TEST(TestSplitValue) { TOptsNoDefault opts; - TVector<TString> vals; + TVector<TString> vals; opts.AddLongOption('s', "split").SplitHandler(&vals, ','); TOptsParseResultTestWrapper r(&opts, V({"prog", "--split=a,b,c"})); - UNIT_ASSERT_EQUAL(vals.size(), 3); + UNIT_ASSERT_EQUAL(vals.size(), 3); UNIT_ASSERT_EQUAL(vals[0], "a"); UNIT_ASSERT_EQUAL(vals[1], "b"); UNIT_ASSERT_EQUAL(vals[2], "c"); @@ -494,10 +494,10 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { Y_UNIT_TEST(TestRangeSplitValue) { TOptsNoDefault opts; - TVector<ui32> vals; + TVector<ui32> vals; opts.AddLongOption('s', "split").RangeSplitHandler(&vals, ',', '-'); TOptsParseResultTestWrapper r(&opts, V({"prog", "--split=1,8-10", "--split=12-14"})); - UNIT_ASSERT_EQUAL(vals.size(), 7); + UNIT_ASSERT_EQUAL(vals.size(), 7); UNIT_ASSERT_EQUAL(vals[0], 1); UNIT_ASSERT_EQUAL(vals[1], 8); UNIT_ASSERT_EQUAL(vals[2], 9); @@ -577,7 +577,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { Y_UNIT_TEST(TestTitleAndPrintUsage) { TOpts opts; const char* prog = "my_program"; - TString title = TString("Sample ") + TString(prog).Quote() + " application"; + TString title = TString("Sample ") + TString(prog).Quote() + " application"; opts.SetTitle(title); int argc = 2; const char* cmd[] = {prog}; @@ -585,15 +585,15 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { TStringStream out; parser.PrintUsage(out); // find title - UNIT_ASSERT(out.Str().find(title) != TString::npos); + UNIT_ASSERT(out.Str().find(title) != TString::npos); // find usage - UNIT_ASSERT(out.Str().find(" " + TString(prog) + " ") != TString::npos); + UNIT_ASSERT(out.Str().find(" " + TString(prog) + " ") != TString::npos); } Y_UNIT_TEST(TestCustomCmdLineDescr) { TOpts opts; const char* prog = "my_program"; - TString customDescr = "<FILE|TABLE> USER [OPTIONS]"; + TString customDescr = "<FILE|TABLE> USER [OPTIONS]"; int argc = 2; const char* cmd[] = {prog}; opts.SetCmdLineDescr(customDescr); @@ -601,7 +601,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { TStringStream out; parser.PrintUsage(out); // find custom usage - UNIT_ASSERT(out.Str().find(customDescr) != TString::npos); + UNIT_ASSERT(out.Str().find(customDescr) != TString::npos); } Y_UNIT_TEST(TestColorPrint) { @@ -622,28 +622,28 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { parser.PrintUsage(out, colors); // find options and green color - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "--long_option" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "--other" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-o" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-d" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-s" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "--long_option" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "--other" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-o" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-d" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-s" << colors.OldColor()) != TString::npos); // find default values - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.CyanColor() << "42" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.CyanColor() << "\"str_default\"" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.CyanColor() << "42" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.CyanColor() << "\"str_default\"" << colors.OldColor()) != TString::npos); // find free args - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "123" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "456" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "first_free_arg" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "123" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "456" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "first_free_arg" << colors.OldColor()) != TString::npos); // free args without help not rendered even if they have custom title UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "second_free_arg" << colors.OldColor()) == TString::npos); // find signatures - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Usage" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Required parameters" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Optional parameters" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Free args" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Usage" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Required parameters" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Optional parameters" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Free args" << colors.OldColor()) != TString::npos); // find sections UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Section" << colors.OldColor() << ":") != TString::npos); @@ -652,10 +652,10 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { // print without colors TStringStream out2; opts.PrintUsage(prog, out2); - UNIT_ASSERT(out2.Str().find(colors.GreenColor()) == TString::npos); - UNIT_ASSERT(out2.Str().find(colors.CyanColor()) == TString::npos); - UNIT_ASSERT(out2.Str().find(colors.BoldColor()) == TString::npos); - UNIT_ASSERT(out2.Str().find(colors.OldColor()) == TString::npos); + UNIT_ASSERT(out2.Str().find(colors.GreenColor()) == TString::npos); + UNIT_ASSERT(out2.Str().find(colors.CyanColor()) == TString::npos); + UNIT_ASSERT(out2.Str().find(colors.BoldColor()) == TString::npos); + UNIT_ASSERT(out2.Str().find(colors.OldColor()) == TString::npos); } Y_UNIT_TEST(TestPadding) { @@ -675,21 +675,21 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { NColorizer::TColors colors(withColors); parser.PrintUsage(out, colors); - TString printed = out.Str(); + TString printed = out.Str(); if (withColors) { // remove not printable characters - SubstGlobal(printed, TString(colors.BoldColor()), ""); - SubstGlobal(printed, TString(colors.GreenColor()), ""); - SubstGlobal(printed, TString(colors.CyanColor()), ""); - SubstGlobal(printed, TString(colors.OldColor()), ""); + SubstGlobal(printed, TString(colors.BoldColor()), ""); + SubstGlobal(printed, TString(colors.GreenColor()), ""); + SubstGlobal(printed, TString(colors.CyanColor()), ""); + SubstGlobal(printed, TString(colors.OldColor()), ""); } - TVector<TString> lines; + TVector<TString> lines; StringSplitter(printed).Split('\n').SkipEmpty().Collect(&lines); UNIT_ASSERT(!lines.empty()); - TVector<size_t> indents; - for (const TString& line : lines) { + TVector<size_t> indents; + for (const TString& line : lines) { const size_t indent = line.find("description "); - if (indent != TString::npos) + if (indent != TString::npos) indents.push_back(indent); } UNIT_ASSERT_VALUES_EQUAL(indents.size(), 7); @@ -701,7 +701,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { } Y_UNIT_TEST(TestAppendTo) { - TVector<int> ints; + TVector<int> ints; TOptsNoDefault opts; opts.AddLongOption("size").AppendTo(&ints); diff --git a/library/cpp/getopt/ut/opt_ut.cpp b/library/cpp/getopt/ut/opt_ut.cpp index 441aa493a0..aad842a46e 100644 --- a/library/cpp/getopt/ut/opt_ut.cpp +++ b/library/cpp/getopt/ut/opt_ut.cpp @@ -24,7 +24,7 @@ Y_UNIT_TEST_SUITE(OptTest) { int argc = 5; Opt opts(argc, argv, "", options); - UNIT_ASSERT_VALUES_EQUAL(JoinStrings(opts.GetFreeArgs(), ", "), "ARG1, ARG3"); + UNIT_ASSERT_VALUES_EQUAL(JoinStrings(opts.GetFreeArgs(), ", "), "ARG1, ARG3"); } Y_UNIT_TEST(TestLongOption) { @@ -37,7 +37,7 @@ Y_UNIT_TEST_SUITE(OptTest) { int argc = 5; Opt opts(argc, argv, "", options); - TString optionValue = ""; + TString optionValue = ""; int optlet = 0; while ((optlet = opts.Get()) != EOF) { if (optlet == SOME_OPTION_ID) { diff --git a/library/cpp/getopt/ut/posix_getopt_ut.cpp b/library/cpp/getopt/ut/posix_getopt_ut.cpp index b6d374bf28..7a9dbf6c5c 100644 --- a/library/cpp/getopt/ut/posix_getopt_ut.cpp +++ b/library/cpp/getopt/ut/posix_getopt_ut.cpp @@ -13,9 +13,9 @@ Y_UNIT_TEST_SUITE(TPosixGetoptTest) { NLastGetopt::optreset = 1; UNIT_ASSERT_VALUES_EQUAL('b', NLastGetopt::getopt(argc, argv, "bf:")); UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt(argc, argv, "bf:")); - UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("1")); + UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("1")); UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt(argc, argv, "bf:")); - UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("2")); + UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("2")); UNIT_ASSERT_VALUES_EQUAL(-1, NLastGetopt::getopt(argc, argv, "bf:")); UNIT_ASSERT_VALUES_EQUAL(5, NLastGetopt::optind); diff --git a/library/cpp/getopt/ut/ygetopt_ut.cpp b/library/cpp/getopt/ut/ygetopt_ut.cpp index a76f117216..29cfb0e8e3 100644 --- a/library/cpp/getopt/ut/ygetopt_ut.cpp +++ b/library/cpp/getopt/ut/ygetopt_ut.cpp @@ -29,8 +29,8 @@ void TGetOptTest::TestGetOpt() { "-q", nullptr}; - TString res; - const TString format = "qzp:f"; + TString res; + const TString format = "qzp:f"; TGetOpt opt(sizeof(argv) / sizeof(*argv) - 1, argv, format); for (TGetOpt::TIterator it = opt.Begin(); it != opt.End(); ++it) { |