diff options
| author | Anton Samokhvalov <[email protected]> | 2022-02-10 16:45:17 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:17 +0300 | 
| commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
| tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/getopt/ut | |
| parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
Restoring authorship annotation for Anton Samokhvalov <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/getopt/ut')
| -rw-r--r-- | library/cpp/getopt/ut/last_getopt_ut.cpp | 58 | ||||
| -rw-r--r-- | library/cpp/getopt/ut/opt2_ut.cpp | 46 | ||||
| -rw-r--r-- | library/cpp/getopt/ut/opt_ut.cpp | 18 | ||||
| -rw-r--r-- | library/cpp/getopt/ut/posix_getopt_ut.cpp | 64 | ||||
| -rw-r--r-- | library/cpp/getopt/ut/ygetopt_ut.cpp | 80 | 
5 files changed, 133 insertions, 133 deletions
diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp index 0bdfff4f524..c99a1d053d1 100644 --- a/library/cpp/getopt/ut/last_getopt_ut.cpp +++ b/library/cpp/getopt/ut/last_getopt_ut.cpp @@ -1,5 +1,5 @@  #include <library/cpp/getopt/last_getopt.h> -  +  #include <library/cpp/colorizer/colors.h>  #include <library/cpp/testing/unittest/registar.h> @@ -11,14 +11,14 @@  using namespace NLastGetopt;  namespace { -    struct TOptsNoDefault: public TOpts {  +    struct TOptsNoDefault: public TOpts {          TOptsNoDefault(const TStringBuf& optstring = TStringBuf())              : TOpts(optstring)          {          }      }; -    class TOptsParseResultTestWrapper: public TOptsParseResultException {  +    class TOptsParseResultTestWrapper: public TOptsParseResultException {          TVector<const char*> Argv_;      public: @@ -174,11 +174,11 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {          UNIT_ASSERT_EXCEPTION(              TOptsParseResultTestWrapper(&opts, V({"cp", "/etc", "/tmp/etc", "verbose", "nosymlink"})), -            yexception);  +            yexception);          UNIT_ASSERT_EXCEPTION(              TOptsParseResultTestWrapper(&opts, V({"cp"})), -            yexception);  +            yexception);          opts.SetFreeArgsNum(2);          TOptsParseResultTestWrapper r22(&opts, V({"cp", "/etc", "/var/tmp"})); @@ -347,16 +347,16 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {      }      Y_UNIT_TEST(TestDuplicatedOptionCrash) { -        // this test is broken, cause UNIT_ASSERT(false) always throws  -        return;  -  +        // this test is broken, cause UNIT_ASSERT(false) always throws +        return; +          bool exception = false;          try {              TOpts opts;              opts.AddLongOption('x', "one");              opts.AddLongOption('x', "two");              UNIT_ASSERT(false); -        } catch (...) {  +        } catch (...) {              // we should go here, duplicating options are forbidden              exception = true;          } @@ -529,21 +529,21 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {          opt_d.Required();          UNIT_ASSERT_EXCEPTION(              TOptsParseResultTestWrapper(&opts, V({"cmd"})), -            TUsageException);  +            TUsageException);          TOptsParseResultTestWrapper r3(&opts, V({"cmd", "-d11"}));          UNIT_ASSERT_VALUES_EQUAL("11", r3.Get('d'));      } -    class HandlerStoreTrue {  -        bool* Flag;  -  +    class HandlerStoreTrue { +        bool* Flag; +      public: -        HandlerStoreTrue(bool* flag)  +        HandlerStoreTrue(bool* flag)              : Flag(flag)          {          } -        void operator()() {  +        void operator()() {              *Flag = true;          }      }; @@ -561,11 +561,11 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {              double fval = 0.0;              opts.AddLongOption("flag1").RequiredArgument().StoreResult(&uval);              opts.AddLongOption("flag2").RequiredArgument().StoreResultT<int>(&uval); -            opts.AddLongOption("flag3").RequiredArgument().StoreMappedResult(&fval, (double (*)(double))fabs);  -            opts.AddLongOption("flag4").RequiredArgument().StoreMappedResult(&fval, (double (*)(double))sqrt);  +            opts.AddLongOption("flag3").RequiredArgument().StoreMappedResult(&fval, (double (*)(double))fabs); +            opts.AddLongOption("flag4").RequiredArgument().StoreMappedResult(&fval, (double (*)(double))sqrt);              UNIT_ASSERT_EXCEPTION(                  TOptsParseResultTestWrapper(&opts, V({"cmd", "--flag3", "-2.0", "--flag1", "-1"})), -                yexception);  +                yexception);              UNIT_ASSERT_VALUES_EQUAL(uval, 5u);              UNIT_ASSERT_VALUES_EQUAL(fval, 2.0);              TOptsParseResultTestWrapper r1(&opts, V({"cmd", "--flag4", "9.0", "--flag2", "-1"})); @@ -580,7 +580,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {          TString title = TString("Sample ") + TString(prog).Quote() + " application";          opts.SetTitle(title);          int argc = 2; -        const char* cmd[] = {prog};  +        const char* cmd[] = {prog};          TOptsParser parser(&opts, argc, cmd);          TStringStream out;          parser.PrintUsage(out); @@ -595,7 +595,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {          const char* prog = "my_program";          TString customDescr = "<FILE|TABLE> USER [OPTIONS]";          int argc = 2; -        const char* cmd[] = {prog};  +        const char* cmd[] = {prog};          opts.SetCmdLineDescr(customDescr);          TOptsParser parser(&opts, argc, cmd);          TStringStream out; @@ -615,7 +615,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {          opts.SetFreeArgTitle(0, "first_free_arg", "help");          opts.SetFreeArgTitle(2, "second_free_arg");          opts.AddSection("Section", "Section\n  text"); -        const char* cmd[] = {prog};  +        const char* cmd[] = {prog};          TOptsParser parser(&opts, Y_ARRAY_SIZE(cmd), cmd);          TStringStream out;          NColorizer::TColors colors(true); @@ -663,12 +663,12 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {          for (bool withColors : withColorsOpt) {              TOpts opts;              const char* prog = "my_program"; -            opts.AddLongOption("option", "description 1").Required();               // long option  -            opts.AddLongOption('o', "other", "description 2");                      // char and long option  -            opts.AddCharOption('d', "description 3").RequiredArgument("DD");        // char option  +            opts.AddLongOption("option", "description 1").Required();               // long option +            opts.AddLongOption('o', "other", "description 2");                      // char and long option +            opts.AddCharOption('d', "description 3").RequiredArgument("DD");        // char option              opts.AddCharOption('s', "description 4\ndescription 5\ndescription 6"); // multiline desc              opts.AddLongOption('l', "very_very_very_loooong_ooooption", "description 7").RequiredArgument("LONG_ARGUMENT"); -            const char* cmd[] = {prog};  +            const char* cmd[] = {prog};              TOptsParser parser(&opts, Y_ARRAY_SIZE(cmd), cmd);              TStringStream out; @@ -730,7 +730,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {          TStringBuilder keyvals;          TOptsNoDefault opts; -        opts.AddLongOption("set").KVHandler([&keyvals](TString k, TString v) { keyvals << k << ":" << v << ","; });  +        opts.AddLongOption("set").KVHandler([&keyvals](TString k, TString v) { keyvals << k << ":" << v << ","; });          TOptsParseResultTestWrapper r(&opts, V({"cmd", "--set", "x=1", "--set", "y=2", "--set=z=3"})); @@ -740,7 +740,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {      Y_UNIT_TEST(TestEasySetup) {          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");  +        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; @@ -758,7 +758,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {          {              UNIT_ASSERT_EXCEPTION(                  TOptsParseResultTestWrapper(&opts, V({"cmd", "--true"})), -                TUsageException);  +                TUsageException);          }          { @@ -777,7 +777,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) {          // Should throw TUsageException. Other exception types, no exceptions at all and exit(1) are failures          UNIT_ASSERT_EXCEPTION(              TOptsParseResultException(&opts, Y_ARRAY_SIZE(argv), argv), -            TUsageException);  +            TUsageException);      }      Y_UNIT_TEST(TestFreeArgsStoreResult) { diff --git a/library/cpp/getopt/ut/opt2_ut.cpp b/library/cpp/getopt/ut/opt2_ut.cpp index 4f7b6150374..0e7464747cb 100644 --- a/library/cpp/getopt/ut/opt2_ut.cpp +++ b/library/cpp/getopt/ut/opt2_ut.cpp @@ -1,5 +1,5 @@  #include <library/cpp/getopt/opt2.h> -  +  #include <library/cpp/testing/unittest/registar.h>  //using namespace NLastGetopt; @@ -8,25 +8,25 @@ Y_UNIT_TEST_SUITE(Opt2Test) {      Y_UNIT_TEST(TestSimple) {          int argc = 8;          char* argv[] = { -            (char*)"cmd",  -            (char*)"--aaaa=aaaa",  -            (char*)"zz",  -            (char*)"-x1",  -            (char*)"-x2",  -            (char*)"-c",  -            (char*)"-d8",  -            (char*)"ww",  +            (char*)"cmd", +            (char*)"--aaaa=aaaa", +            (char*)"zz", +            (char*)"-x1", +            (char*)"-x2", +            (char*)"-c", +            (char*)"-d8", +            (char*)"ww",          };          Opt2 opt(argc, argv, "A:b:cd:e:x:", 2, "aaaa=A"); -        const char* edef = "edef";  -        const char* a = opt.Arg('A', "<var_name> - usage of -A");  -        int b = opt.Int('b', "<var_name> - usage of -b", 2);  -        bool c = opt.Has('c', "usage of -c");  -        int d = opt.Int('d', "<var_name> - usage of -d", 13);  -        const char* e = opt.Arg('e', "<unused> - only default is really used", edef);  -        const TVector<const char*>& x = opt.MArg('x', "<var_name> - usage of -x");  +        const char* edef = "edef"; +        const char* a = opt.Arg('A', "<var_name> - usage of -A"); +        int b = opt.Int('b', "<var_name> - usage of -b", 2); +        bool c = opt.Has('c', "usage of -c"); +        int d = opt.Int('d', "<var_name> - usage of -d", 13); +        const char* e = opt.Arg('e', "<unused> - only default is really used", edef); +        const TVector<const char*>& x = opt.MArg('x', "<var_name> - usage of -x");          UNIT_ASSERT(!opt.AutoUsage("<L> <M>"));          UNIT_ASSERT_VALUES_EQUAL("aaaa", a); @@ -46,17 +46,17 @@ Y_UNIT_TEST_SUITE(Opt2Test) {      Y_UNIT_TEST(TestErrors1) {          int argc = 4;          char* argv[] = { -            (char*)"cmd",  -            (char*)"zz",  -            (char*)"-c",  -            (char*)"-e",  +            (char*)"cmd", +            (char*)"zz", +            (char*)"-c", +            (char*)"-e",          };          Opt2 opt(argc, argv, "ce:", 2); -        const char* edef = "edef";  -        bool c = opt.Has('c', "usage of -c");  -        const char* e = opt.Arg('e', "<unused> - only default is really used", edef);  +        const char* edef = "edef"; +        bool c = opt.Has('c', "usage of -c"); +        const char* e = opt.Arg('e', "<unused> - only default is really used", edef);          UNIT_ASSERT(c);          UNIT_ASSERT_VALUES_EQUAL((void*)edef, e);      } diff --git a/library/cpp/getopt/ut/opt_ut.cpp b/library/cpp/getopt/ut/opt_ut.cpp index 031105b4cb4..441aa493a0a 100644 --- a/library/cpp/getopt/ut/opt_ut.cpp +++ b/library/cpp/getopt/ut/opt_ut.cpp @@ -1,5 +1,5 @@  #include <library/cpp/getopt/opt.h> -  +  #include <library/cpp/testing/unittest/registar.h>  #include <util/string/vector.h> @@ -7,7 +7,7 @@ Y_UNIT_TEST_SUITE(OptTest) {      Y_UNIT_TEST(TestSimple) {          int argc = 3;          char* argv[] = { -            (char*)"cmd", (char*)"-x"};  +            (char*)"cmd", (char*)"-x"};          Opt opt(argc, argv, "");          opt.Err = false; // be quiet          UNIT_ASSERT_VALUES_EQUAL('?', opt.Get()); @@ -18,9 +18,9 @@ Y_UNIT_TEST_SUITE(OptTest) {      Y_UNIT_TEST(TestFreeArguments) {          Opt::Ion options[] = { -            {"some-option", Opt::WithArg, nullptr, 123},  -            {nullptr, Opt::WithoutArg, nullptr, 0}};  -        const char* argv[] = {"cmd", "ARG1", "-some-option", "ARG2", "ARG3", nullptr};  +            {"some-option", Opt::WithArg, nullptr, 123}, +            {nullptr, Opt::WithoutArg, nullptr, 0}}; +        const char* argv[] = {"cmd", "ARG1", "-some-option", "ARG2", "ARG3", nullptr};          int argc = 5;          Opt opts(argc, argv, "", options); @@ -30,10 +30,10 @@ Y_UNIT_TEST_SUITE(OptTest) {      Y_UNIT_TEST(TestLongOption) {          const int SOME_OPTION_ID = 12345678;          Opt::Ion options[] = { -            {"some-option", Opt::WithArg, nullptr, SOME_OPTION_ID},  -            {nullptr, Opt::WithoutArg, nullptr, 0}};  +            {"some-option", Opt::WithArg, nullptr, SOME_OPTION_ID}, +            {nullptr, Opt::WithoutArg, nullptr, 0}};          for (int doubleDash = 0; doubleDash <= 1; ++doubleDash) { -            const char* argv[] = {"cmd", "ARG1", (doubleDash ? "--some-option" : "-some-option"), "ARG2", "ARG3", nullptr};  +            const char* argv[] = {"cmd", "ARG1", (doubleDash ? "--some-option" : "-some-option"), "ARG2", "ARG3", nullptr};              int argc = 5;              Opt opts(argc, argv, "", options); @@ -42,7 +42,7 @@ Y_UNIT_TEST_SUITE(OptTest) {              while ((optlet = opts.Get()) != EOF) {                  if (optlet == SOME_OPTION_ID) {                      optionValue = opts.GetArg(); -                } else {  +                } else {                      UNIT_FAIL("don't expected any options, except -some-option");                  }              } diff --git a/library/cpp/getopt/ut/posix_getopt_ut.cpp b/library/cpp/getopt/ut/posix_getopt_ut.cpp index 549a5ae3a2b..b6d374bf28b 100644 --- a/library/cpp/getopt/ut/posix_getopt_ut.cpp +++ b/library/cpp/getopt/ut/posix_getopt_ut.cpp @@ -1,5 +1,5 @@  #include <library/cpp/getopt/posix_getopt.h> -  +  #include <library/cpp/testing/unittest/registar.h>  using namespace NLastGetopt; @@ -7,8 +7,8 @@ using namespace NLastGetopt;  Y_UNIT_TEST_SUITE(TPosixGetoptTest) {      Y_UNIT_TEST(TestSimple) {          int argc = 6; -        const char* argv0[] = {"program", "-b", "-f1", "-f", "2", "zzzz"};  -        char** const argv = (char**)argv0;  +        const char* argv0[] = {"program", "-b", "-f1", "-f", "2", "zzzz"}; +        char** const argv = (char**)argv0;          NLastGetopt::optreset = 1;          UNIT_ASSERT_VALUES_EQUAL('b', NLastGetopt::getopt(argc, argv, "bf:")); @@ -25,14 +25,14 @@ Y_UNIT_TEST_SUITE(TPosixGetoptTest) {          int daggerset = 0;          /* options descriptor */          const NLastGetopt::option longopts[] = { -            {"buffy", no_argument, nullptr, 'b'},  -            {"fluoride", required_argument, nullptr, 'f'},  -            {"daggerset", no_argument, &daggerset, 1},  -            {nullptr, 0, nullptr, 0}};  +            {"buffy", no_argument, nullptr, 'b'}, +            {"fluoride", required_argument, nullptr, 'f'}, +            {"daggerset", no_argument, &daggerset, 1}, +            {nullptr, 0, nullptr, 0}};          int argc = 7; -        const char* argv0[] = {"program", "-b", "--buffy", "-f1", "--fluoride=2", "--daggerset", "zzzz"};  -        char** const argv = (char**)argv0;  +        const char* argv0[] = {"program", "-b", "--buffy", "-f1", "--fluoride=2", "--daggerset", "zzzz"}; +        char** const argv = (char**)argv0;          int longIndex; @@ -53,14 +53,14 @@ Y_UNIT_TEST_SUITE(TPosixGetoptTest) {          int daggerset = 0;          /* options descriptor */          const NLastGetopt::option longopts[] = { -            {"buffy", no_argument, nullptr, 'b'},  -            {"fluoride", required_argument, nullptr, 'f'},  -            {"daggerset", no_argument, &daggerset, 1},  -            {nullptr, 0, nullptr, 0}};  +            {"buffy", no_argument, nullptr, 'b'}, +            {"fluoride", required_argument, nullptr, 'f'}, +            {"daggerset", no_argument, &daggerset, 1}, +            {nullptr, 0, nullptr, 0}};          int argc = 7; -        const char* argv0[] = {"program", "aa", "-b", "bb", "cc", "--buffy", "dd"};  -        char** const argv = (char**)argv0;  +        const char* argv0[] = {"program", "aa", "-b", "bb", "cc", "--buffy", "dd"}; +        char** const argv = (char**)argv0;          NLastGetopt::optreset = 1;          UNIT_ASSERT_VALUES_EQUAL('b', NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr)); @@ -72,13 +72,13 @@ Y_UNIT_TEST_SUITE(TPosixGetoptTest) {      Y_UNIT_TEST(TestNoOptionsOptionsWithDoubleDash) {          const NLastGetopt::option longopts[] = { -            {"buffy", no_argument, nullptr, 'b'},  -            {"fluoride", no_argument, nullptr, 'f'},  -            {nullptr, 0, nullptr, 0}};  +            {"buffy", no_argument, nullptr, 'b'}, +            {"fluoride", no_argument, nullptr, 'f'}, +            {nullptr, 0, nullptr, 0}};          int argc = 2; -        const char* argv0[] = {"program", "--bf"};  -        char** const argv = (char**)argv0;  +        const char* argv0[] = {"program", "--bf"}; +        char** const argv = (char**)argv0;          NLastGetopt::optreset = 1;          UNIT_ASSERT_VALUES_EQUAL('?', NLastGetopt::getopt_long(argc, argv, "bf", longopts, nullptr)); @@ -86,32 +86,32 @@ Y_UNIT_TEST_SUITE(TPosixGetoptTest) {      Y_UNIT_TEST(TestLongOnly) {          const NLastGetopt::option longopts[] = { -            {"foo", no_argument, nullptr, 'F'},  -            {"fluoride", no_argument, nullptr, 'f'},  -            {"ogogo", no_argument, nullptr, 'o'},  -            {nullptr, 0, nullptr, 0}};  +            {"foo", no_argument, nullptr, 'F'}, +            {"fluoride", no_argument, nullptr, 'f'}, +            {"ogogo", no_argument, nullptr, 'o'}, +            {nullptr, 0, nullptr, 0}};          int argc = 4; -        const char* argv0[] = {"program", "--foo", "-foo", "-fo"};  -        char** const argv = (char**)argv0;  +        const char* argv0[] = {"program", "--foo", "-foo", "-fo"}; +        char** const argv = (char**)argv0;          NLastGetopt::optreset = 1;          UNIT_ASSERT_VALUES_EQUAL('F', NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));          UNIT_ASSERT_VALUES_EQUAL('F', NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));          UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));          UNIT_ASSERT_VALUES_EQUAL('o', NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr)); -        UNIT_ASSERT_VALUES_EQUAL(-1, NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));  +        UNIT_ASSERT_VALUES_EQUAL(-1, NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));      }      Y_UNIT_TEST(TestLongWithoutOnlySingleDashNowAllowed) {          const NLastGetopt::option longopts[] = { -            {"foo", no_argument, nullptr, 'F'},  -            {"zoo", no_argument, nullptr, 'z'},  -            {nullptr, 0, nullptr, 0}};  +            {"foo", no_argument, nullptr, 'F'}, +            {"zoo", no_argument, nullptr, 'z'}, +            {nullptr, 0, nullptr, 0}};          int argc = 2; -        const char* argv0[] = {"program", "-foo"};  -        char** const argv = (char**)argv0;  +        const char* argv0[] = {"program", "-foo"}; +        char** const argv = (char**)argv0;          NLastGetopt::optreset = 1;          UNIT_ASSERT_VALUES_EQUAL('?', NLastGetopt::getopt_long(argc, argv, "z", longopts, nullptr)); diff --git a/library/cpp/getopt/ut/ygetopt_ut.cpp b/library/cpp/getopt/ut/ygetopt_ut.cpp index 99fa51281e8..a76f1172166 100644 --- a/library/cpp/getopt/ut/ygetopt_ut.cpp +++ b/library/cpp/getopt/ut/ygetopt_ut.cpp @@ -1,45 +1,45 @@  #include <library/cpp/getopt/ygetopt.h> -  +  #include <library/cpp/testing/unittest/registar.h> -  -class TGetOptTest: public TTestBase {  -    UNIT_TEST_SUITE(TGetOptTest);  -    UNIT_TEST(TestGetOpt);  -    UNIT_TEST_EXCEPTION(TestZeroArgC, yexception);  -    UNIT_TEST_SUITE_END();  -  -public:  -    void TestGetOpt();  -    void TestZeroArgC();  -};  -  -UNIT_TEST_SUITE_REGISTRATION(TGetOptTest);  -  -void TGetOptTest::TestZeroArgC() {  + +class TGetOptTest: public TTestBase { +    UNIT_TEST_SUITE(TGetOptTest); +    UNIT_TEST(TestGetOpt); +    UNIT_TEST_EXCEPTION(TestZeroArgC, yexception); +    UNIT_TEST_SUITE_END(); + +public: +    void TestGetOpt(); +    void TestZeroArgC(); +}; + +UNIT_TEST_SUITE_REGISTRATION(TGetOptTest); + +void TGetOptTest::TestZeroArgC() {      TGetOpt opt(0, nullptr, ""); -}  -  -void TGetOptTest::TestGetOpt() {  -    const char* argv[] = {  -        "/usr/bin/bash",  -        "-f",  -        "-p",  -        "qwerty123",  -        "-z",  -        "-q",  -        nullptr};  -  +} + +void TGetOptTest::TestGetOpt() { +    const char* argv[] = { +        "/usr/bin/bash", +        "-f", +        "-p", +        "qwerty123", +        "-z", +        "-q", +        nullptr}; +      TString res;      const TString format = "qzp:f"; -    TGetOpt opt(sizeof(argv) / sizeof(*argv) - 1, argv, format);  -  -    for (TGetOpt::TIterator it = opt.Begin(); it != opt.End(); ++it) {  -        res += it->Key();  -  -        if (it->HaveArg()) {  -            res += it->Arg();  -        }  -    }  -  -    UNIT_ASSERT_EQUAL(res, "fpqwerty123zq");  -}  +    TGetOpt opt(sizeof(argv) / sizeof(*argv) - 1, argv, format); + +    for (TGetOpt::TIterator it = opt.Begin(); it != opt.End(); ++it) { +        res += it->Key(); + +        if (it->HaveArg()) { +            res += it->Arg(); +        } +    } + +    UNIT_ASSERT_EQUAL(res, "fpqwerty123zq"); +}  | 
