Add more tests for XmlWrite::write* members

This commit is contained in:
Martin Hořeňovský
2021-10-02 14:39:52 +02:00
parent c6640e4f47
commit 13670f535f
3 changed files with 49 additions and 2 deletions
+3 -2
View File
@@ -295,13 +295,14 @@ namespace {
}
XmlWriter& XmlWriter::writeText( StringRef text, XmlFormatting fmt ) {
CATCH_ENFORCE(!m_tags.empty(), "Cannot write text as top level element");
if( !text.empty() ){
bool tagWasOpen = m_tagIsOpen;
ensureTagClosed();
if (tagWasOpen && shouldIndent(fmt)) {
m_os << m_indent;
}
m_os << XmlEncode( text );
m_os << XmlEncode( text, XmlEncode::ForTextNodes );
applyFormatting(fmt);
}
return *this;
@@ -312,7 +313,7 @@ namespace {
if (shouldIndent(fmt)) {
m_os << m_indent;
}
m_os << "<!--" << text << "-->";
m_os << "<!-- " << text << " -->";
applyFormatting(fmt);
return *this;
}