diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-07-21 00:14:14 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-07-21 09:40:34 +0200 |
commit | 23bfaf601d78ab2a80ec5493ef7eab1410975769 (patch) | |
tree | 949387d52537c0d7911241e3d7ac8ec89d07fc8b /basic | |
parent | dae5dc8d8992cbc5fa2ef3b1d5167847005491b4 (diff) |
tdf#134576: basic_macros: Add unittest
Change-Id: I6078e0712f7983159ea3b3f2060a1c4b69e9d5c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99114
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/qa/cppunit/test_nested_struct.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/basic/qa/cppunit/test_nested_struct.cxx b/basic/qa/cppunit/test_nested_struct.cxx index 009d832b1ce6..daced48ba2bf 100644 --- a/basic/qa/cppunit/test_nested_struct.cxx +++ b/basic/qa/cppunit/test_nested_struct.cxx @@ -28,6 +28,7 @@ namespace void testFixedVarAssign(); void testFixedVarAssignAlt(); // result is uno-ised and tested void testUnoAccess(); // fdo#60117 specific test + void testTdf134576(); // Adds code needed to register the test suite CPPUNIT_TEST_SUITE(Nested_Struct); @@ -42,6 +43,7 @@ namespace CPPUNIT_TEST(testFixedVarAssign); CPPUNIT_TEST(testFixedVarAssignAlt); CPPUNIT_TEST(testUnoAccess); + CPPUNIT_TEST(testTdf134576); // End of test suite definition CPPUNIT_TEST_SUITE_END(); @@ -296,6 +298,24 @@ void Nested_Struct::testUnoAccess() CPPUNIT_ASSERT_EQUAL(200, result ); } +void Nested_Struct::testTdf134576() +{ + MacroSnippet myMacro("Function doUnitTest()\n" + " On Error Resume Next\n" + " For Each a In b\n" + " c.d\n" + " Next\n" + " doUnitTest = 1\n" + "End Function\n"); + + myMacro.Compile(); + CPPUNIT_ASSERT(!myMacro.HasError()); + + // Without the fix in place, it would have crashed here + SbxVariableRef pNew = myMacro.Run(); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), pNew->GetInteger()); +} + // Put the test suite in the registry CPPUNIT_TEST_SUITE_REGISTRATION(Nested_Struct); } |