Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / basic / qa / basic_coverage / test_method_name_variable.bas
blobda9e83bca26e97d2d63ab6053226f5ad4942835e
1 ' This file is part of the LibreOffice project.
3 ' This Source Code Form is subject to the terms of the Mozilla Public
4 ' License, v. 2.0. If a copy of the MPL was not distributed with this
5 ' file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 Option Explicit
10 Function assignVarToMethod() As Integer
12 ' method name used as dimension specifier
13 Dim fieldOfLongs() As Long
14 ReDim fieldOfLongs(assignVarToMethod) As Long
16 ' method name used as loop index
17 Dim sum As Integer
18 For assignVarToMethod = 1 To 3
19 sum = sum + assignVarToMethod
20 Next assignVarToMethod
21 assignVarToMethod = sum
23 End Function
25 Function doUnitTest() As String
27 doUnitTest = "FAIL"
29 ' tdf#85371 - check if the name of the method can be used as a variable in certain statements
30 If (assignVarToMethod() <> 6) Then Exit Function
31 ' tdf#85371 - check if an assignment to the function fails outside of the function itself
32 assignVarToMethod = 0
33 If (assignVarToMethod() <> 6) Then Exit Function
35 doUnitTest = "OK"
37 End Function