mirror of https://github.com/AxioDL/tinyxml2.git
trim the test cases and review
This commit is contained in:
parent
321072ee0b
commit
9c0678a01d
21
xmltest.cpp
21
xmltest.cpp
|
@ -624,28 +624,29 @@ int main( int argc, const char ** argv )
|
||||||
doc.Parse( str );
|
doc.Parse( str );
|
||||||
XMLElement* element = doc.RootElement();
|
XMLElement* element = doc.RootElement();
|
||||||
|
|
||||||
element->SetText("He kept turning his head to left and right, but I could not see anything through the darkness.");
|
element->SetText("darkness.");
|
||||||
XMLTest( "SetText() normal use (open/close).", "He kept turning his head to left and right, but I could not see anything through the darkness.", element->GetText() );
|
XMLTest( "SetText() normal use (open/close).", "darkness.", element->GetText() );
|
||||||
|
|
||||||
element->SetText("Suddenly, away on our left I saw a faint flickering blue flame.");
|
element->SetText("blue flame.");
|
||||||
XMLTest( "SetText() replace.", "Suddenly, away on our left I saw a faint flickering blue flame.", element->GetText() );
|
XMLTest( "SetText() replace.", "blue flame.", element->GetText() );
|
||||||
|
|
||||||
str = "<foo/>";
|
str = "<foo/>";
|
||||||
doc.Parse( str );
|
doc.Parse( str );
|
||||||
element = doc.RootElement();
|
element = doc.RootElement();
|
||||||
|
|
||||||
element->SetText("The driver saw it at the same moment.");
|
element->SetText("The driver");
|
||||||
XMLTest( "SetText() normal use. (self-closing)", "The driver saw it at the same moment.", element->GetText() );
|
XMLTest( "SetText() normal use. (self-closing)", "The driver", element->GetText() );
|
||||||
|
|
||||||
element->SetText("<b>He at once checked the horses, and, jumping to the ground, disappeared into the darkness.</b>");
|
element->SetText("<b>horses</b>");
|
||||||
XMLTest( "SetText() replace with tag-like text.", "<b>He at once checked the horses, and, jumping to the ground, disappeared into the darkness.</b>", element->GetText() );
|
XMLTest( "SetText() replace with tag-like text.", "<b>horses</b>", element->GetText() );
|
||||||
|
//doc.Print();
|
||||||
|
|
||||||
str = "<foo><bar>Text in nested element</bar></foo>";
|
str = "<foo><bar>Text in nested element</bar></foo>";
|
||||||
doc.Parse( str );
|
doc.Parse( str );
|
||||||
element = doc.RootElement();
|
element = doc.RootElement();
|
||||||
|
|
||||||
element->SetText("I did not know what to do, the less as the howling of the wolves grew closer.");
|
element->SetText("wolves");
|
||||||
XMLTest( "SetText() prefix to nested non-text children.", "I did not know what to do, the less as the howling of the wolves grew closer.", element->GetText() );
|
XMLTest( "SetText() prefix to nested non-text children.", "wolves", element->GetText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue