diff options
author | tldr <tldr@yandex-team.com> | 2024-11-21 17:37:20 +0300 |
---|---|---|
committer | tldr <tldr@yandex-team.com> | 2024-11-21 17:55:22 +0300 |
commit | c8482a7c9c43883e325c2ab31b58cb62abde7eba (patch) | |
tree | ec354b3e3856cba3b385d824d4b567f1ccf58b39 /library/cpp/getopt/ut/last_getopt_ut.cpp | |
parent | cafe0d9f1f5555e43c16cbb1c73375fee224eca6 (diff) | |
download | ydb-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.cpp | 13 |
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; |