src/utest/utestArgs.cpp
void ArgsTest::testHelpCustom()
{
    ts::ReportBuffer<> log;
    TestArgs args(&log);

    TSUNIT_ASSERT(!args.analyze(u"test", USV({u"--help"})));
    TSUNIT_EQUAL(u"\n"
        u"{description}\n"
        u"\n"
        u"Usage: test {syntax}\n"
        u"\n"
        u"Parameters:\n"
        u"\n"
        u"  The parameters\n"
        u"\n"
        u"Options:\n"
        u"\n"
        u"  -d[level]\n"
        u"  --debug[=level]\n"
        u"      Produce debug traces. The default level is 1. Higher levels produce more\n"
        u"      messages.\n"
        u"\n"
        u"  --help\n"
        u"      Display this help text.\n"
        u"\n"
        u"  --mask value\n"
        u"      Enumeration, unlimited count.\n"
        u"      Must be one of \"bit1\", \"bit2\", \"bit3\".\n"
        u"\n"
        u"  --opt1\n"
        u"      No value.\n"
        u"\n"
        u"  --opt10 value\n"
        u"      Unsigned int 3 decimal digits.\n"
        u"      The value may include up to 3 meaningful decimal digits.\n"
        u"\n"
        u"  -a value\n"
        u"  --opt2 value\n"
        u"      String value.\n"
        u"\n"
        u"  --opt3 value\n"
        u"      Integer from -4 to 7, unlimited count.\n"
        u"\n"
        u"  --opt4 value\n"
        u"      Integer from 0 to 2.\n"
        u"\n"
        u"  -5 value\n"
        u"  --opt5 value\n"
        u"      Positive integer, unlimited count.\n"
        u"\n"
        u"  -b value\n"
        u"  --opt6 value\n"
        u"      Unsigned int, 8 bits.\n"
        u"\n"
        u"  --opt7 value\n"
        u"      Unsigned int, 16 bits.\n"
        u"\n"
        u"  --opt8[=value]\n"
        u"      Unsigned int, 32 bits, optional value.\n"
        u"\n"
        u"  -c value\n"
        u"  --opt9 value\n"
        u"      Enumeration.\n"
        u"      Must be one of \"val1\", \"val2\", \"val3\".\n"
        u"\n"
        u"  -v\n"
        u"  --verbose\n"
        u"      Produce verbose output.\n"
        u"\n"
        u"  --version\n"
        u"      Display the TSDuck version number.\n",
        log.getMessages());
}
// Test case: help text of a custom commmand.
Test case: help text of a custom commmand.
Test case : help text of a custom commmand .
void ArgsTest::testHelpCustom()
{
    ts::ReportBuffer<> log;
    TestArgs args(&log);
    TSUNIT_ASSERT(!args.analyze(u"test", USV({u"--help"})));
    TSUNIT_EQUAL(u"\n"
        u"{description}\n"
        u"\n"
        u"Usage: test {syntax}\n"
        u"\n"
        u"Parameters:\n"
        u"\n"
        u"  The parameters\n"
        u"\n"
        u"Options:\n"
        u"\n"
        u"  -d[level]\n"
        u"  --debug[=level]\n"
        u"      Produce debug traces. The default level is 1. Higher levels produce more\n"
        u"      messages.\n"
        u"\n"
        u"  --help\n"
        u"      Display this help text.\n"
        u"\n"
        u"  --mask value\n"
        u"      Enumeration, unlimited count.\n"
        u"      Must be one of \"bit1\", \"bit2\", \"bit3\".\n"
        u"\n"
        u"  --opt1\n"
        u"      No value.\n"
        u"\n"
        u"  --opt10 value\n"
        u"      Unsigned int 3 decimal digits.\n"
        u"      The value may include up to 3 meaningful decimal digits.\n"
        u"\n"
        u"  -a value\n"
        u"  --opt2 value\n"
        u"      String value.\n"
        u"\n"
        u"  --opt3 value\n"
        u"      Integer from -4 to 7, unlimited count.\n"
        u"\n"
        u"  --opt4 value\n"
        u"      Integer from 0 to 2.\n"
        u"\n"
        u"  -5 value\n"
        u"  --opt5 value\n"
        u"      Positive integer, unlimited count.\n"
        u"\n"
        u"  -b value\n"
        u"  --opt6 value\n"
        u"      Unsigned int, 8 bits.\n"
        u"\n"
        u"  --opt7 value\n"
        u"      Unsigned int, 16 bits.\n"
        u"\n"
        u"  --opt8[=value]\n"
        u"      Unsigned int, 32 bits, optional value.\n"
        u"\n"
        u"  -c value\n"
        u"  --opt9 value\n"
        u"      Enumeration.\n"
        u"      Must be one of \"val1\", \"val2\", \"val3\".\n"
        u"\n"
        u"  -v\n"
        u"  --verbose\n"
        u"      Produce verbose output.\n"
        u"\n"
        u"  --version\n"
        u"      Display the TSDuck version number.\n",
        log.getMessages());
}
void ArgsTest :: testHelpCustom ( ) { ts :: ReportBuffer < > log ; TestArgs args ( & log ) ; TSUNIT_ASSERT ( ! args . analyze ( u" " , USV ( { u" " } ) ) ) ; TSUNIT_EQUAL ( u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \" \" \" \" \" \" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \" \" \" \" \" \" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " u" \n " , log . getMessages ( ) ) ; }
Test case: help text of a custom commmand.
Test case : help text of a custom commmand .