diff options
author | nikkon <nikkon@yandex-team.ru> | 2022-02-10 16:50:55 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:55 +0300 |
commit | 74f244adb5fa85ca0f82ad35f22cfc6218aedcb6 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/getopt | |
parent | 36794b6add2511fbbb24bf6cf74144f1188cb9d8 (diff) | |
download | ydb-74f244adb5fa85ca0f82ad35f22cfc6218aedcb6.tar.gz |
Restoring authorship annotation for <nikkon@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/getopt')
-rw-r--r-- | library/cpp/getopt/ut/last_getopt_ut.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp index 9d1a9732a9..c99a1d053d 100644 --- a/library/cpp/getopt/ut/last_getopt_ut.cpp +++ b/library/cpp/getopt/ut/last_getopt_ut.cpp @@ -125,13 +125,13 @@ struct TOptsParserTester { } }; -namespace { +namespace { bool gSimpleFlag = false; - void SimpleHander(void) { - gSimpleFlag = true; - } -} - + void SimpleHander(void) { + gSimpleFlag = true; + } +} + Y_UNIT_TEST_SUITE(TLastGetoptTests) { Y_UNIT_TEST(TestEqual) { TOptsNoDefault opts; @@ -738,36 +738,36 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { } Y_UNIT_TEST(TestEasySetup) { - TEasySetup opts; - bool flag = false; + TEasySetup opts; + bool flag = false; opts('v', "version", "print version information")('a', "abstract", "some abstract param", true)('b', "buffer", "SIZE", "some param with argument")('c', "count", "SIZE", "some param with required argument")('t', "true", HandlerStoreTrue(&flag), "Some arg with handler")("global", SimpleHander, "Another arg with handler"); - - { - gSimpleFlag = false; + + { + gSimpleFlag = false; TOptsParseResultTestWrapper r(&opts, V({"cmd", "--abstract"})); - UNIT_ASSERT(!flag); - UNIT_ASSERT(!gSimpleFlag); - } - - { + UNIT_ASSERT(!flag); + UNIT_ASSERT(!gSimpleFlag); + } + + { TOptsParseResultTestWrapper r(&opts, V({"cmd", "--abstract", "--global", "-t"})); - UNIT_ASSERT(flag); - UNIT_ASSERT(gSimpleFlag); - } - - { + UNIT_ASSERT(flag); + UNIT_ASSERT(gSimpleFlag); + } + + { UNIT_ASSERT_EXCEPTION( TOptsParseResultTestWrapper(&opts, V({"cmd", "--true"})), TUsageException); - } - - { + } + + { TOptsParseResultTestWrapper r(&opts, V({"cmd", "--abstract", "--buffer=512"})); - UNIT_ASSERT(r.Has('b')); - UNIT_ASSERT_VALUES_EQUAL(r.Get('b', 0), "512"); - } - } - + UNIT_ASSERT(r.Has('b')); + UNIT_ASSERT_VALUES_EQUAL(r.Get('b', 0), "512"); + } + } + Y_UNIT_TEST(TestTOptsParseResultException) { // verify that TOptsParseResultException actually throws a TUsageException instead of exit() // not using wrapper here because it can hide bugs (see review #243810 and r2737774) |