Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / basic / qa / cppunit / test_compiler_checks.cxx
blob044977670e624afcec3f14780f835ed156c492f5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 <sal/config.h>
11 #include "basictest.hxx"
12 #include <basic/sberrors.hxx>
13 #include <unotest/bootstrapfixturebase.hxx>
15 CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testRedefineArgument)
17 MacroSnippet aMacro("Sub doUnitTest(argName)\n"
18 " If False Then\n"
19 " Dim argName\n"
20 " End If\n"
21 "End Sub\n");
22 aMacro.Compile();
23 CPPUNIT_ASSERT(aMacro.HasError());
24 CPPUNIT_ASSERT_EQUAL(ERRCODE_BASIC_VAR_DEFINED, aMacro.getError().StripDynamic());
27 CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testDoubleArgument)
29 MacroSnippet aMacro("Sub doUnitTest(argName, argName)\n"
30 "End Sub\n");
31 aMacro.Compile();
32 CPPUNIT_ASSERT(aMacro.HasError());
33 CPPUNIT_ASSERT_EQUAL(ERRCODE_BASIC_VAR_DEFINED, aMacro.getError().StripDynamic());
36 CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf149157)
38 MacroSnippet aMacro("Function extentComment() As Integer\n"
39 " ' _\n"
40 " If Not extentComment Then\n"
41 " extentComment = 1\n"
42 " End If\n"
43 "End Function\n");
44 aMacro.Compile();
45 CPPUNIT_ASSERT(!aMacro.HasError());
48 CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf149157_compatible)
50 MacroSnippet aMacro("Option Compatible\n"
51 "Function extentComment() As Integer\n"
52 " ' _\n"
53 "\n"
54 " If Not extentComment Then\n"
55 " extentComment = 1\n"
56 " End If\n"
57 "End Function\n");
58 aMacro.Compile();
59 CPPUNIT_ASSERT(!aMacro.HasError());
62 CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf149157_vba)
64 MacroSnippet aMacro("Option VBASupport 1\n"
65 "Function extentComment() As Integer\n"
66 " ' _\n"
67 "\n"
68 " If Not extentComment Then\n"
69 " extentComment = 1\n"
70 " End If\n"
71 "End Function\n");
72 aMacro.Compile();
73 CPPUNIT_ASSERT(!aMacro.HasError());
76 CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf149402)
78 MacroSnippet aMacro("Function extentComment() As Integer\n"
79 " ' _ \n"
80 " If Not extentComment Then\n"
81 " extentComment = 1\n"
82 " Else\n"
83 " End If\n"
84 "End Function\n");
85 aMacro.Compile();
86 CPPUNIT_ASSERT(!aMacro.HasError());
89 CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf149402_compatible)
91 MacroSnippet aMacro("Option Compatible\n"
92 "Function extentComment() As Integer\n"
93 " ' _ \n"
94 " If Not extentComment Then\n"
95 " extentComment = 1\n"
96 " Else\n"
97 " End If\n"
98 "End Function\n");
99 aMacro.Compile();
100 CPPUNIT_ASSERT(!aMacro.HasError());
103 CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf149402_vba)
105 MacroSnippet aMacro("Option VBASupport 1\n"
106 "Function extentComment() As Integer\n"
107 " ' _ \n"
108 " If Not extentComment Then\n"
109 " extentComment = 1\n"
110 " Else\n"
111 " End If\n"
112 "End Function\n");
113 aMacro.Compile();
114 CPPUNIT_ASSERT(!aMacro.HasError());
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */