diff options
author | Ryan Harrison <rharrison@chromium.org> | 2017-07-25 11:10:15 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-25 15:26:28 +0000 |
commit | 952477dbee761a6e38ce675f2095bbfc9cfd7450 (patch) | |
tree | c248f649135de60d81d87d9b0afebc153a589d69 /xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp | |
parent | 364d18b13575a2b569e9fc175cb0dd60106fa954 (diff) | |
download | pdfium-952477dbee761a6e38ce675f2095bbfc9cfd7450.tar.xz |
Clean up data passing in FormCalc Lexerchromium/3167
This CL removes the pattern used in the lexer of passing the lexing
member variables around as args to methods. Instead it uses the fact
that they are member variables in the methods.
This CL also includes renaming of variable and function names to
remove unneeded details or make them more precise.
BUG=pdfium:814
Change-Id: Id4c592338db9ff462835314252d39ab3b4b2b2ab
Reviewed-on: https://pdfium-review.googlesource.com/8850
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp')
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp index 5a8139d416..92b8fa93b3 100644 --- a/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmlexer_unittest.cpp @@ -22,44 +22,44 @@ TEST(CXFA_FMLexerTest, Numbers) { // TODO(dsinclair): Should this return -12 instead of two tokens? EXPECT_EQ(TOKminus, token->m_type); token = lexer->NextToken(); - EXPECT_EQ(L"12", token->m_wstring); + EXPECT_EQ(L"12", token->m_string); token = lexer->NextToken(); EXPECT_EQ(TOKeof, token->m_type); 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); + EXPECT_EQ(L"1.5362", token->m_string); 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); + EXPECT_EQ(L"0.875", token->m_string); 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); + EXPECT_EQ(L"5.56e-2", token->m_string); 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); + EXPECT_EQ(L"1.234E10", token->m_string); 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); + // EXPECT_EQ(L"123456789.01234567", token->m_string); + EXPECT_EQ(L"123456789.012345678", token->m_string); 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 // prior to the exponent. - // EXPECT_EQ(L"100000000000000000", token->m_wstring); - EXPECT_EQ(L"99999999999999999", token->m_wstring); + // EXPECT_EQ(L"100000000000000000", token->m_string); + EXPECT_EQ(L"99999999999999999", token->m_string); } // The quotes are stripped in CXFA_FMStringExpression::ToJavaScript. @@ -68,7 +68,7 @@ TEST(CXFA_FMLexerTest, Strings) { 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); + EXPECT_EQ(L"\"The cat jumped over the fence.\"", token->m_string); token = lexer->NextToken(); EXPECT_EQ(TOKeof, token->m_type); @@ -76,14 +76,14 @@ TEST(CXFA_FMLexerTest, Strings) { lexer = pdfium::MakeUnique<CXFA_FMLexer>(L"\"\""); token = lexer->NextToken(); EXPECT_EQ(TOKstring, token->m_type); - EXPECT_EQ(L"\"\"", token->m_wstring); + EXPECT_EQ(L"\"\"", token->m_string); lexer = pdfium::MakeUnique<CXFA_FMLexer>( 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); + token->m_string); lexer = pdfium::MakeUnique<CXFA_FMLexer>( L"\"\\u0047\\u006f\\u0066\\u0069\\u0073\\u0068\\u0021\\u000d\\u000a\""); @@ -91,7 +91,7 @@ TEST(CXFA_FMLexerTest, Strings) { EXPECT_EQ(TOKstring, token->m_type); EXPECT_EQ( L"\"\\u0047\\u006f\\u0066\\u0069\\u0073\\u0068\\u0021\\u000d\\u000a\"", - token->m_wstring); + token->m_string); } // Note, 'this' is a keyword but is not matched by the lexer. @@ -178,11 +178,11 @@ TEST(CXFA_FMLexerTest, Comments) { 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); + EXPECT_EQ(L"123", token->m_string); token = lexer->NextToken(); EXPECT_EQ(TOKstring, token->m_type); - EXPECT_EQ(L"\"str\"", token->m_wstring); + EXPECT_EQ(L"\"str\"", token->m_string); token = lexer->NextToken(); EXPECT_EQ(TOKeof, token->m_type); @@ -198,11 +198,11 @@ TEST(CXFA_FMLexerTest, Comments) { 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); + EXPECT_EQ(L"123", token->m_string); token = lexer->NextToken(); EXPECT_EQ(TOKstring, token->m_type); - EXPECT_EQ(L"\"str\"", token->m_wstring); + EXPECT_EQ(L"\"str\"", token->m_string); token = lexer->NextToken(); EXPECT_EQ(TOKeof, token->m_type); @@ -215,7 +215,7 @@ TEST(CXFA_FMLexerTest, ValidIdentifiers) { auto lexer = pdfium::MakeUnique<CXFA_FMLexer>(ident); CXFA_FMToken* token = lexer->NextToken(); EXPECT_EQ(TOKidentifier, token->m_type); - EXPECT_EQ(ident, token->m_wstring); + EXPECT_EQ(ident, token->m_string); } } @@ -260,11 +260,11 @@ TEST(CXFA_FMLexerTest, Whitespace) { 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); + EXPECT_EQ(L"123", token->m_string); token = lexer->NextToken(); EXPECT_EQ(TOKnumber, token->m_type); - EXPECT_EQ(L"456", token->m_wstring); + EXPECT_EQ(L"456", token->m_string); token = lexer->NextToken(); EXPECT_EQ(TOKeof, token->m_type); |