From 406b23d9350777514e499cefdc080212de596e8d Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 5 Mar 2018 21:04:51 +0000 Subject: [formcalc] Cleanup m_error handling This CL cleans up the setting of m_error. In most cases we don't need to set m_error it will be set when we bubble up the nullptr return from the various parse methods. The m_error was set inconsitently previously and was confusing on if it needed to be set or not. Change-Id: I8648b6296ef15239bd2663e6543a960b88177721 Reviewed-on: https://pdfium-review.googlesource.com/27910 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp') diff --git a/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp index a7f7006fcc..d1e5919324 100644 --- a/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp @@ -15,7 +15,7 @@ TEST(CXFA_FMParserTest, Empty) { auto parser = pdfium::MakeUnique(L""); std::unique_ptr ast = parser->Parse(); - ASSERT(ast != nullptr); + ASSERT_TRUE(ast); EXPECT_FALSE(parser->HasError()); CXFA_FMToJavaScriptDepth::Reset(); @@ -28,7 +28,7 @@ TEST(CXFA_FMParserTest, Empty) { TEST(CXFA_FMParserTest, CommentOnlyIsError) { auto parser = pdfium::MakeUnique(L"; Just comment"); std::unique_ptr ast = parser->Parse(); - ASSERT(ast != nullptr); + ASSERT_TRUE(ast); // TODO(dsinclair): This isn't allowed per the spec. EXPECT_FALSE(parser->HasError()); // EXPECT_TRUE(parser->HasError()); @@ -49,7 +49,7 @@ TEST(CXFA_FMParserTest, CommentThenValue) { auto parser = pdfium::MakeUnique(L"; Just comment\n12"); std::unique_ptr ast = parser->Parse(); - ASSERT(ast != nullptr); + ASSERT_TRUE(ast); EXPECT_FALSE(parser->HasError()); CXFA_FMToJavaScriptDepth::Reset(); @@ -118,7 +118,7 @@ TEST(CXFA_FMParserTest, Parse) { auto parser = pdfium::MakeUnique(input); std::unique_ptr ast = parser->Parse(); - ASSERT(ast != nullptr); + ASSERT_TRUE(ast); EXPECT_FALSE(parser->HasError()); CXFA_FMToJavaScriptDepth::Reset(); @@ -147,7 +147,7 @@ TEST(CXFA_FMParserTest, MultipleAssignmentIsNotAllowed) { auto parser = pdfium::MakeUnique(L"(a=(b=t))=u"); std::unique_ptr ast = parser->Parse(); - ASSERT(ast == nullptr); + ASSERT_TRUE(!ast); EXPECT_TRUE(parser->HasError()); } @@ -170,7 +170,7 @@ TEST(CXFA_FMParserTest, ParseFuncWithParams) { auto parser = pdfium::MakeUnique(input); std::unique_ptr ast = parser->Parse(); - ASSERT(ast != nullptr); + ASSERT_TRUE(ast); EXPECT_FALSE(parser->HasError()); CXFA_FMToJavaScriptDepth::Reset(); @@ -198,7 +198,7 @@ TEST(CXFA_FMParserTest, ParseFuncWithoutParams) { auto parser = pdfium::MakeUnique(input); std::unique_ptr ast = parser->Parse(); - ASSERT(ast != nullptr); + ASSERT_TRUE(ast); EXPECT_FALSE(parser->HasError()); CXFA_FMToJavaScriptDepth::Reset(); -- cgit v1.2.3