Kaynağa Gözat

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 yıl önce
ebeveyn
işleme
03768a9f23
1 değiştirilmiş dosya ile 38 ekleme ve 2 silme
  1. 38
    2
      TestConfiguration/testConfiguration.cpp

+ 38
- 2
TestConfiguration/testConfiguration.cpp Dosyayı Görüntüle

@@ -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…
İptal
Kaydet