Browse Source

Tested issue: Incorrect value loaded for attribute value equal to "".


git-svn-id: https://svn.microneil.com/svn/CodeDweller-Tests/trunk@37 b3372362-9eaa-4a85-aa2b-6faa1ab7c995
master
adeniz 9 years ago
parent
commit
03768a9f23
1 changed files with 38 additions and 2 deletions
  1. 38
    2
      TestConfiguration/testConfiguration.cpp

+ 38
- 2
TestConfiguration/testConfiguration.cpp View File

" <stage\n" " <stage\n"
" name='" + expectedNameAttr + "'\n" " name='" + expectedNameAttr + "'\n"
" na='" + expectedNaAttr + "'\n" " na='" + expectedNaAttr + "'\n"
" nameLong='" + expectedNameLongAttr + "'/>"
"</elem>";
" nameLong='" + expectedNameLongAttr + "'\n"
"/></elem>";
CodeDweller::ConfigurationData confData(xml.data(), xml.size()); CodeDweller::ConfigurationData confData(xml.data(), xml.size());
} }
bool testNullAttributeValue() {
std::string xml = "<data name='messageContent' value=''/>";
CodeDweller::ConfigurationData confData(xml.data(), xml.size());
CodeDweller::ConfigurationElement reader("data");
std::string nameAttr, valueAttr, setAttr;
reader
.Attribute("name", nameAttr)
.Attribute("value", valueAttr, ">")
.Attribute("set", setAttr, ">")
.End("data");
reader.initialize();
if (0 == reader.interpret(confData)) {
RETURN_FALSE("Error parsing XML: " + confData.Log.str());
}
if ("messageContent" != nameAttr) {
RETURN_FALSE("\"name\" attribute read failure");
}
if ("" != valueAttr) {
std::cout << "Expected \"\", got \"" << valueAttr << "\".\n";
RETURN_FALSE("\"value\" attribute read failure");
}
if (">" != setAttr) {
RETURN_FALSE("\"set\" attribute read failure");
}
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// End of tests //////////////////////////////////////////////////////////////// // End of tests ////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
RUN_TEST(testSimilarElementName); RUN_TEST(testSimilarElementName);
RUN_TEST(testSimilarAttributeName); RUN_TEST(testSimilarAttributeName);
RUN_TEST(testNullAttributeValue);
SUMMARY; SUMMARY;

Loading…
Cancel
Save