summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-05-17 22:17:34 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-05-18 15:27:37 +0000
commit2034b941dfa07d30c286bfcceffd6904740ac446 (patch)
tree1bc3c9be4d3108b53ced4db9837187dddf6df88d /xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp
parentcfd56852b6375d2b4eea473399231caf7dcdbf36 (diff)
downloadpdfium-2034b941dfa07d30c286bfcceffd6904740ac446.tar.xz
Remove CXFA_FMErrorInfo
This Cl removes the CXFA_FMErrorInfo class. The message was never output, just used as a flag to determine if there was an error. The class has been replaced with a boolean. Change-Id: I1cde99ce6957f5f8c6be0755a198d80ec8378b3a Reviewed-on: https://pdfium-review.googlesource.com/5653 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp')
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp47
1 files changed, 23 insertions, 24 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp
index f47e985c8c..7ca12d2fad 100644
--- a/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp
@@ -11,13 +11,13 @@
#include "third_party/base/ptr_util.h"
TEST(CXFA_FMLexerTest, EmptyString) {
- CXFA_FMLexer lexer(L"", nullptr);
+ CXFA_FMLexer lexer(L"");
CXFA_FMToken* token = lexer.NextToken();
EXPECT_EQ(TOKeof, token->m_type);
}
TEST(CXFA_FMLexerTest, Numbers) {
- auto lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"-12", nullptr);
+ auto lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"-12");
CXFA_FMToken* token = lexer->NextToken();
// TODO(dsinclair): Should this return -12 instead of two tokens?
EXPECT_EQ(TOKminus, token->m_type);
@@ -26,34 +26,34 @@ TEST(CXFA_FMLexerTest, Numbers) {
token = lexer->NextToken();
EXPECT_EQ(TOKeof, token->m_type);
- lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"1.5362", nullptr);
+ lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"1.5362");
token = lexer->NextToken();
EXPECT_EQ(TOKnumber, token->m_type);
EXPECT_EQ(L"1.5362", token->m_wstring);
- lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"0.875", nullptr);
+ lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"0.875");
token = lexer->NextToken();
EXPECT_EQ(TOKnumber, token->m_type);
EXPECT_EQ(L"0.875", token->m_wstring);
- lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"5.56e-2", nullptr);
+ lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"5.56e-2");
token = lexer->NextToken();
EXPECT_EQ(TOKnumber, token->m_type);
EXPECT_EQ(L"5.56e-2", token->m_wstring);
- lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"1.234E10", nullptr);
+ lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"1.234E10");
token = lexer->NextToken();
EXPECT_EQ(TOKnumber, token->m_type);
EXPECT_EQ(L"1.234E10", token->m_wstring);
- lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"123456789.012345678", nullptr);
+ lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"123456789.012345678");
token = lexer->NextToken();
EXPECT_EQ(TOKnumber, token->m_type);
// TODO(dsinclair): This should round as per IEEE 64-bit values.
// EXPECT_EQ(L"123456789.01234567", token->m_wstring);
EXPECT_EQ(L"123456789.012345678", token->m_wstring);
- lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"99999999999999999", nullptr);
+ lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"99999999999999999");
token = lexer->NextToken();
EXPECT_EQ(TOKnumber, token->m_type);
// TODO(dsinclair): This is spec'd as rounding when > 16 significant digits
@@ -64,8 +64,8 @@ TEST(CXFA_FMLexerTest, Numbers) {
// The quotes are stripped in CXFA_FMStringExpression::ToJavaScript.
TEST(CXFA_FMLexerTest, Strings) {
- auto lexer = pdfium::MakeUnique<CXFA_FMLexer>(
- L"\"The cat jumped over the fence.\"", nullptr);
+ auto lexer =
+ pdfium::MakeUnique<CXFA_FMLexer>(L"\"The cat jumped over the fence.\"");
CXFA_FMToken* token = lexer->NextToken();
EXPECT_EQ(TOKstring, token->m_type);
EXPECT_EQ(L"\"The cat jumped over the fence.\"", token->m_wstring);
@@ -73,21 +73,20 @@ TEST(CXFA_FMLexerTest, Strings) {
token = lexer->NextToken();
EXPECT_EQ(TOKeof, token->m_type);
- lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"\"\"", nullptr);
+ lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"\"\"");
token = lexer->NextToken();
EXPECT_EQ(TOKstring, token->m_type);
EXPECT_EQ(L"\"\"", token->m_wstring);
lexer = pdfium::MakeUnique<CXFA_FMLexer>(
- L"\"The message reads: \"\"Warning: Insufficient Memory\"\"\"", nullptr);
+ L"\"The message reads: \"\"Warning: Insufficient Memory\"\"\"");
token = lexer->NextToken();
EXPECT_EQ(TOKstring, token->m_type);
EXPECT_EQ(L"\"The message reads: \"\"Warning: Insufficient Memory\"\"\"",
token->m_wstring);
lexer = pdfium::MakeUnique<CXFA_FMLexer>(
- L"\"\\u0047\\u006f\\u0066\\u0069\\u0073\\u0068\\u0021\\u000d\\u000a\"",
- nullptr);
+ L"\"\\u0047\\u006f\\u0066\\u0069\\u0073\\u0068\\u0021\\u000d\\u000a\"");
token = lexer->NextToken();
EXPECT_EQ(TOKstring, token->m_type);
EXPECT_EQ(
@@ -161,22 +160,22 @@ TEST(CXFA_FMLexerTest, OperatorsAndKeywords) {
{L".*", TOKdotstar}};
for (size_t i = 0; i < FX_ArraySize(op); ++i) {
- auto lexer = pdfium::MakeUnique<CXFA_FMLexer>(op[i].op, nullptr);
+ auto lexer = pdfium::MakeUnique<CXFA_FMLexer>(op[i].op);
CXFA_FMToken* token = lexer->NextToken();
EXPECT_EQ(op[i].token, token->m_type);
}
}
TEST(CXFA_FMLexerTest, Comments) {
- auto lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"// Empty.", nullptr);
+ auto lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"// Empty.");
CXFA_FMToken* token = lexer->NextToken();
EXPECT_EQ(TOKeof, token->m_type);
- lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"//", nullptr);
+ lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"//");
token = lexer->NextToken();
EXPECT_EQ(TOKeof, token->m_type);
- lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"123 // Empty.\n\"str\"", nullptr);
+ lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"123 // Empty.\n\"str\"");
token = lexer->NextToken();
EXPECT_EQ(TOKnumber, token->m_type);
EXPECT_EQ(L"123", token->m_wstring);
@@ -188,15 +187,15 @@ TEST(CXFA_FMLexerTest, Comments) {
token = lexer->NextToken();
EXPECT_EQ(TOKeof, token->m_type);
- lexer = pdfium::MakeUnique<CXFA_FMLexer>(L";", nullptr);
+ lexer = pdfium::MakeUnique<CXFA_FMLexer>(L";");
token = lexer->NextToken();
EXPECT_EQ(TOKeof, token->m_type);
- lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"; Empty.", nullptr);
+ lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"; Empty.");
token = lexer->NextToken();
EXPECT_EQ(TOKeof, token->m_type);
- lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"123 ;Empty.\n\"str\"", nullptr);
+ lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"123 ;Empty.\n\"str\"");
token = lexer->NextToken();
EXPECT_EQ(TOKnumber, token->m_type);
EXPECT_EQ(L"123", token->m_wstring);
@@ -213,7 +212,7 @@ TEST(CXFA_FMLexerTest, Identifiers) {
std::vector<const wchar_t*> identifiers = {
L"a", L"an_identifier", L"_ident", L"$ident", L"!ident", L"GetAddr"};
for (const auto* ident : identifiers) {
- auto lexer = pdfium::MakeUnique<CXFA_FMLexer>(ident, nullptr);
+ auto lexer = pdfium::MakeUnique<CXFA_FMLexer>(ident);
CXFA_FMToken* token = lexer->NextToken();
EXPECT_EQ(TOKidentifier, token->m_type);
EXPECT_EQ(ident, token->m_wstring);
@@ -221,11 +220,11 @@ TEST(CXFA_FMLexerTest, Identifiers) {
}
TEST(CXFA_FMLexerTest, Whitespace) {
- auto lexer = pdfium::MakeUnique<CXFA_FMLexer>(L" \t\xc\x9\xb", nullptr);
+ auto lexer = pdfium::MakeUnique<CXFA_FMLexer>(L" \t\xc\x9\xb");
CXFA_FMToken* token = lexer->NextToken();
EXPECT_EQ(TOKeof, token->m_type);
- lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"123 \t\xc\x9\xb 456", nullptr);
+ lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"123 \t\xc\x9\xb 456");
token = lexer->NextToken();
EXPECT_EQ(TOKnumber, token->m_type);
EXPECT_EQ(L"123", token->m_wstring);