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 | 36794b6add2511fbbb24bf6cf74144f1188cb9d8 (patch) | |
tree | 7e9c6a3a11dc550eab1df219ad2f2a158a087670 /library/cpp | |
parent | de3b858ab298fa807404fb6eda460cd4f7cbc5dd (diff) | |
download | ydb-36794b6add2511fbbb24bf6cf74144f1188cb9d8.tar.gz |
Restoring authorship annotation for <nikkon@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
-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 c99a1d053d..9d1a9732a9 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) |