Преглед на файлове

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 години
родител
ревизия
03768a9f23
променени са 1 файла, в които са добавени 38 реда и са изтрити 2 реда
  1. 38
    2
      TestConfiguration/testConfiguration.cpp

+ 38
- 2
TestConfiguration/testConfiguration.cpp Целия файл

@@ -120,8 +120,8 @@ bool testSimilarAttributeName() {
" <stage\n"
" name='" + expectedNameAttr + "'\n"
" na='" + expectedNaAttr + "'\n"
" nameLong='" + expectedNameLongAttr + "'/>"
"</elem>";
" nameLong='" + expectedNameLongAttr + "'\n"
"/></elem>";
CodeDweller::ConfigurationData confData(xml.data(), xml.size());
@@ -145,6 +145,41 @@ bool testSimilarAttributeName() {
}
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 ////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
@@ -156,6 +191,7 @@ int main()
RUN_TEST(testSimilarElementName);
RUN_TEST(testSimilarAttributeName);
RUN_TEST(testNullAttributeValue);
SUMMARY;

Loading…
Отказ
Запис