summaryrefslogtreecommitdiff
path: root/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-05 16:33:44 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-05 20:36:33 +0000
commit5f983bb6aeae696ec5577a66771ef19cc3140b49 (patch)
tree2e0ec281852feb3c8aba93498a80e7c5adcaa886 /xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
parent3198c681df875f7f268f03040b64343741d4bda1 (diff)
downloadpdfium-5f983bb6aeae696ec5577a66771ef19cc3140b49.tar.xz
Update XML syntax parser to return strings
This Cl updates the CFDE_XMLSyntaxParser to return strings instead of taking out parameters. Change-Id: I51124d8d961c00a72987c1a21025d0626b965fab Reviewed-on: https://pdfium-review.googlesource.com/3754 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp')
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp269
1 files changed, 80 insertions, 189 deletions
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
index 9b04028123..e7e6894820 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
+++ b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
@@ -32,34 +32,25 @@ TEST(CFDE_XMLSyntaxParser, CData) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(cdata, data);
+ EXPECT_EQ(cdata, parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -89,34 +80,25 @@ TEST(CFDE_XMLSyntaxParser, CDataWithInnerScript) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(cdata, data);
+ EXPECT_EQ(cdata, parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -136,29 +118,22 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangArrow) {
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -177,22 +152,16 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangBracketArrow) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
// Parser walks to end of input.
@@ -213,22 +182,16 @@ TEST(CFDE_XMLSyntaxParser, IncompleteCData) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
// Parser walks to end of input.
@@ -249,22 +212,16 @@ TEST(CFDE_XMLSyntaxParser, UnClosedCData) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
// Parser walks to end of input.
@@ -285,34 +242,25 @@ TEST(CFDE_XMLSyntaxParser, EmptyCData) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"", data);
+ EXPECT_EQ(L"", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -331,30 +279,22 @@ TEST(CFDE_XMLSyntaxParser, Comment) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -373,30 +313,22 @@ TEST(CFDE_XMLSyntaxParser, IncorrectCommentStart) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -415,30 +347,22 @@ TEST(CFDE_XMLSyntaxParser, CommentEmpty) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -457,22 +381,16 @@ TEST(CFDE_XMLSyntaxParser, CommentThreeDash) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -491,22 +409,16 @@ TEST(CFDE_XMLSyntaxParser, CommentTwoDash) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -529,26 +441,19 @@ TEST(CFDE_XMLSyntaxParser, Entities) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"BTH\xab48", data);
+ EXPECT_EQ(L"BTH\xab48", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -568,26 +473,19 @@ TEST(CFDE_XMLSyntaxParser, EntityOverflowHex) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L" ", data);
+ EXPECT_EQ(L" ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -607,26 +505,19 @@ TEST(CFDE_XMLSyntaxParser, EntityOverflowDecimal) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L" ", data);
+ EXPECT_EQ(L" ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}