Go to the documentation of this file.
27 snprintf(cfgline, 2048,
"%s", s);
30 strncpy(cfgparam, cfgline,
sizeof(cfgparam)-1);
31 cfgparam[
sizeof(cfgparam)-1] =
'\0';
37 const bool interpOk = (unEscaped.
cmp(expectInterp) == 0);
39 printf(
"%25s: %s\n%25s: %s\n%25s: %s\n",
40 "Raw configuration", cfgparam,
41 "Expected interpretation", expectInterp,
42 "Actual interpretation", unEscaped.
termedBuf());
46 bool quotedOk = (strcmp(cfgparam, quoted)==0);
48 printf(
"%25s: %s\n%25s: %s\n%25s: %s\n",
49 "Raw configuration", cfgparam,
50 "Parsed and quoted", quoted,
51 "parsed value was", unEscaped.
termedBuf());
54 return quotedOk && interpOk ;
63 CPPUNIT_ASSERT_EQUAL(
true,
doParseQuotedTest(
"\"This is a quoted \\\"string\\\" by me\"",
64 "This is a quoted \"string\" by me"));
67 CPPUNIT_ASSERT_EQUAL(
true,
doParseQuotedTest(
"\"escape sequence test: \\\\\\\\\\\"\\\\\\\"\\\\\\\\\\\"\"",
68 "escape sequence test: \\\\\"\\\"\\\\\""));
71 CPPUNIT_ASSERT_EQUAL(
true,
doParseQuotedTest(
"\"\\\\beginning and end test\\\"\"",
72 "\\beginning and end test\""));
CPPUNIT_TEST_SUITE_REGISTRATION(testConfigParser)
int cmp(char const *) const
bool doParseQuotedTest(const char *, const char *)
char const * termedBuf() const
static char * NextToken()
static const char * QuoteString(const String &var)
static void SetCfgLine(char *line)
Set the configuration file line to parse.