summaryrefslogtreecommitdiff
path: root/basic/qa/vba_tests/right.vb
blob: 79bcaa2d4015bb603e29ac776c2a3a4054fe85cb (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
Option VBASupport 1
Option Explicit

Function doUnitTest() As String
verify_testRight
doUnitTest = TestUtilModule.GetResult()
End Function

Sub verify_testRight()

    TestUtilModule.TestInit

    Dim testName As String
    Dim date1, date2
    testName = "Test Right function"
    On Error GoTo errorHandler

    date2 = "text"
    date1 = Right("sometext", 4)
    TestUtilModule.AssertTrue(date1 = date2, "the return Right is: " & date1)

    date2 = "sometext"
    date1 = Right("sometext", 48)
    TestUtilModule.AssertTrue(date1 = date2, "the return Right is: " & date1)

    date2 = ""
    date1 = Right("", 4)
    TestUtilModule.AssertTrue(date1 = date2, "the return Right is: " & date1)

    TestUtilModule.TestEnd

    Exit Sub
errorHandler:
        TestUtilModule.AssertTrue(False, testName & ": hit error handler")
End Sub