diff options
Diffstat (limited to 'library/cpp/getopt')
-rw-r--r-- | library/cpp/getopt/small/last_getopt_opt.h | 12 | ||||
-rw-r--r-- | library/cpp/getopt/ut/last_getopt_ut.cpp | 26 |
2 files changed, 19 insertions, 19 deletions
diff --git a/library/cpp/getopt/small/last_getopt_opt.h b/library/cpp/getopt/small/last_getopt_opt.h index 3272af30b2..a8dd5adca9 100644 --- a/library/cpp/getopt/small/last_getopt_opt.h +++ b/library/cpp/getopt/small/last_getopt_opt.h @@ -684,12 +684,12 @@ namespace NLastGetopt { return Handler1T<T>([target](auto&& value) { target->insert(std::move(value)); }); } - // Emplaces TString arg to *target for each argument - template <typename T> - TOpt& EmplaceTo(TVector<T>* target) { - return Handler1T<TString>([target](TString arg) { target->emplace_back(std::move(arg)); } ); - } - + // Emplaces TString arg to *target for each argument + template <typename T> + TOpt& EmplaceTo(TVector<T>* target) { + return Handler1T<TString>([target](TString arg) { target->emplace_back(std::move(arg)); } ); + } + template <class Container> TOpt& SplitHandler(Container* target, const char delim) { return Handler(new NLastGetopt::TOptSplitHandler<Container>(target, delim)); diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp index bfb790b78c..c99a1d053d 100644 --- a/library/cpp/getopt/ut/last_getopt_ut.cpp +++ b/library/cpp/getopt/ut/last_getopt_ut.cpp @@ -713,19 +713,19 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { UNIT_ASSERT_VALUES_EQUAL(19, ints.at(1)); } - Y_UNIT_TEST(TestEmplaceTo) { - TVector<std::tuple<TString>> richPaths; - - TOptsNoDefault opts; - opts.AddLongOption("path").EmplaceTo(&richPaths); - - TOptsParseResultTestWrapper r(&opts, V({"cmd", "--path=<a=b>//cool", "--path=//nice"})); - - UNIT_ASSERT_VALUES_EQUAL(size_t(2), richPaths.size()); - UNIT_ASSERT_VALUES_EQUAL("<a=b>//cool", std::get<0>(richPaths.at(0))); - UNIT_ASSERT_VALUES_EQUAL("//nice", std::get<0>(richPaths.at(1))); - } - + Y_UNIT_TEST(TestEmplaceTo) { + TVector<std::tuple<TString>> richPaths; + + TOptsNoDefault opts; + opts.AddLongOption("path").EmplaceTo(&richPaths); + + TOptsParseResultTestWrapper r(&opts, V({"cmd", "--path=<a=b>//cool", "--path=//nice"})); + + UNIT_ASSERT_VALUES_EQUAL(size_t(2), richPaths.size()); + UNIT_ASSERT_VALUES_EQUAL("<a=b>//cool", std::get<0>(richPaths.at(0))); + UNIT_ASSERT_VALUES_EQUAL("//nice", std::get<0>(richPaths.at(1))); + } + Y_UNIT_TEST(TestKVHandler) { TStringBuilder keyvals; |