aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/getopt/ut/last_getopt_ut.cpp
diff options
context:
space:
mode:
authortldr <tldr@yandex-team.com>2024-11-21 17:37:20 +0300
committertldr <tldr@yandex-team.com>2024-11-21 17:55:22 +0300
commitc8482a7c9c43883e325c2ab31b58cb62abde7eba (patch)
treeec354b3e3856cba3b385d824d4b567f1ccf58b39 /library/cpp/getopt/ut/last_getopt_ut.cpp
parentcafe0d9f1f5555e43c16cbb1c73375fee224eca6 (diff)
downloadydb-c8482a7c9c43883e325c2ab31b58cb62abde7eba.tar.gz
[arc][getopt]fix enforcment of RequiredArgument().DisableSpaceParse()
commit_hash:9c2ada5b95be3f810d2750406d74d839bd2598ff
Diffstat (limited to 'library/cpp/getopt/ut/last_getopt_ut.cpp')
-rw-r--r--library/cpp/getopt/ut/last_getopt_ut.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp
index b517ea359d..8fc9b7ef16 100644
--- a/library/cpp/getopt/ut/last_getopt_ut.cpp
+++ b/library/cpp/getopt/ut/last_getopt_ut.cpp
@@ -449,6 +449,19 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {
tester.AcceptEndOfFreeArgs();
}
+ Y_UNIT_TEST(TestEqParseOnlyRequiredArgument) {
+ TOptsNoDefault opts;
+
+ opts.AddLongOption("eq-only").RequiredArgument().DisableSpaceParse();
+
+ TOptsParseResultTestWrapper res(&opts, V({"cmd", "--eq-only=value"}));
+ UNIT_ASSERT_EQUAL(res.Get("eq-only"), "value"sv);
+
+ UNIT_ASSERT_EXCEPTION(
+ TOptsParseResultTestWrapper(&opts, V({"cmd", "--eq-only", "value"})),
+ TUsageException);
+ }
+
Y_UNIT_TEST(TestStoreResult) {
TOptsNoDefault opts;
TString data;