bump product version to 4.1.6.2
[LibreOffice.git] / basic / qa / cppunit / test_append.cxx
blobff6a56080bdce72ee82536e631365d2eb4e6f707
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include "basictest.hxx"
11 #include "osl/file.hxx"
12 #include "osl/process.h"
14 #include "basic/sbmod.hxx"
15 #include "basic/sbmeth.hxx"
16 namespace
18 class EnableTest : public test::BootstrapFixture
20 public:
21 EnableTest() : BootstrapFixture(true, false) {};
22 void testDimEnable();
23 void testEnableRuntime();
24 // Adds code needed to register the test suite
25 CPPUNIT_TEST_SUITE(EnableTest);
27 // Declares the method as a test to call
28 CPPUNIT_TEST(testDimEnable);
29 CPPUNIT_TEST(testEnableRuntime);
31 // End of test suite definition
32 CPPUNIT_TEST_SUITE_END();
35 OUString sTestEnableRuntime(
36 "Function doUnitTest as Integer\n"
37 "Dim Enable as Integer\n"
38 "Enable = 1\n"
39 "Enable = Enable + 2\n"
40 "doUnitTest = Enable\n"
41 "End Function\n"
44 OUString sTestDimEnable(
45 "Sub doUnitTest\n"
46 "Dim Enable as String\n"
47 "End Sub\n"
50 void EnableTest::testEnableRuntime()
52 MacroSnippet myMacro(sTestEnableRuntime);
53 myMacro.Compile();
54 CPPUNIT_ASSERT_MESSAGE("testEnableRuntime fails with compile error",!myMacro.HasError() );
55 SbxVariableRef pNew = myMacro.Run();
56 CPPUNIT_ASSERT(pNew->GetInteger() == 3 );
59 void EnableTest::testDimEnable()
61 MacroSnippet myMacro(sTestDimEnable);
62 myMacro.Compile();
63 CPPUNIT_ASSERT_MESSAGE("Dim causes compile error", !myMacro.HasError() );
66 // Put the test suite in the registry
67 CPPUNIT_TEST_SUITE_REGISTRATION(EnableTest);
68 } // namespace
69 CPPUNIT_PLUGIN_IMPLEMENT();
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */