1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #include "basictest.hxx"
11 #include "osl/file.hxx"
12 #include "osl/process.h"
14 #include "basic/sbmod.hxx"
15 #include "basic/sbmeth.hxx"
18 class EnableTest
: public test::BootstrapFixture
21 EnableTest() : BootstrapFixture(true, false) {};
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"
39 "Enable = Enable + 2\n"
40 "doUnitTest = Enable\n"
44 OUString
sTestDimEnable(
46 "Dim Enable as String\n"
50 void EnableTest::testEnableRuntime()
52 MacroSnippet
myMacro(sTestEnableRuntime
);
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
);
63 CPPUNIT_ASSERT_MESSAGE("Dim causes compile error", !myMacro
.HasError() );
66 // Put the test suite in the registry
67 CPPUNIT_TEST_SUITE_REGISTRATION(EnableTest
);
69 CPPUNIT_PLUGIN_IMPLEMENT();
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */