diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-01-09 10:05:05 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-01-09 19:08:03 +0000 |
commit | 3c7cba927bb5d234d6d72f65e063754590a7b584 (patch) | |
tree | 5d35dba7d22e91146dee3a999eec9a884a783e25 /basic/qa | |
parent | 9cc91e17172709c65742c092d3f312bce48ac6d9 (diff) |
tdf#152917: basic_macros: Add unittest
Change-Id: I69050ae0e6607ed4a1d1da0e89b45125e2c06e3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145190
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'basic/qa')
-rw-r--r-- | basic/qa/basic_coverage/test_converttofromurl_methods.bas | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/basic/qa/basic_coverage/test_converttofromurl_methods.bas b/basic/qa/basic_coverage/test_converttofromurl_methods.bas index d1dbcfc5ff73..c17d17e631e3 100644 --- a/basic/qa/basic_coverage/test_converttofromurl_methods.bas +++ b/basic/qa/basic_coverage/test_converttofromurl_methods.bas @@ -7,11 +7,28 @@ Option Explicit -Function doUnitTest as String - ' ConvertFromUrl ConvertToUrl - If ( ConvertToUrl( ConvertFromUrl("") ) <> "") Then - doUnitTest = "FAIL" +Function doUnitTest() As String + TestUtil.TestInit + verify_testConvertToFromUrl + doUnitTest = TestUtil.GetResult() +End Function + +Sub verify_testConvertToFromUrl + On Error GoTo errorHandler + + TestUtil.AssertEqual( ConvertToUrl( ConvertFromUrl("") ), "", "ConvertToUrl( ConvertFromUrl("") )") + + ' tdf#152917: Without the fix in place, this test would have failed with + ' Failed: ConvertFromUrl("file:///foo/bar/test.txt") returned , expected /foo/bar/test.txt + If (GetGUIType() <> 1) Then + 'Linux + TestUtil.AssertEqual( ConvertFromUrl("file:///foo/bar/test.txt"), "/foo/bar/test.txt", "ConvertFromUrl(""file:///foo/bar/test.txt"")") Else - doUnitTest = "OK" + 'Windows + TestUtil.AssertEqual( ConvertFromUrl("file://foo/bar/test.txt"), "\\foo\bar\test.txt", "ConvertFromUrl(""file://foo/bar/test.txt"")") End If -End Function + + Exit Sub +errorHandler: + TestUtil.ReportErrorHandler("verify_testConvertToFromUrl", Err, Error$, Erl) +End Sub |