blob: 58fd1db3b3777205bb89d633de9ffe48ca51368c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
'
' This file is part of the LibreOffice project.
'
' This Source Code Form is subject to the terms of the Mozilla Public
' License, v. 2.0. If a copy of the MPL was not distributed with this
' file, You can obtain one at http://mozilla.org/MPL/2.0/.
'
Option Explicit
Dim passCount As Integer
Dim failCount As Integer
Dim result As String
Function doUnitTest() As String
result = verify_tdf125637()
If failCount <> 0 Or passCount = 0 Then
doUnitTest = 0
Else
doUnitTest = 1
End If
End Function
Function verify_tdf125637() As String
passCount = 0
failCount = 0
result = "Test Results" & Chr$(10) & "============" & Chr$(10)
' tdf#125637 - correctly hand names ending with an underscore character at the end of the line
Dim test As Long
Dim test_ As Long
test_ = 1234
test = test_
' Without the fix in place, this test would have failed with:
' - Expected: 1234
' - Actual : 0
TestLog_ASSERT test, 1234, "Assignment of the variable failed (tdf#125637)"
result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
verify_tdf125637 = result
End Function
Sub TestLog_ASSERT(actual As Variant, expected As Variant, testName As String)
If expected = actual Then
passCount = passCount + 1
Else
result = result & Chr$(10) & "Failed: " & testName & " returned " & actual & ", expected " & expected
failCount = failCount + 1
End If
End Sub
|