Files
libreoffice/basic/qa/vba_tests/ole_ObjAssignToNothing.vb
Xisco Fauli a179da299a basic: add missing license statement in .vb test files
Change-Id: I304615540edad3d3486bcdb17d7d6ae12fc084b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144584
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-12-20 12:50:41 +00:00

28 lines
909 B
VB.net

'
' 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 VBASupport 1
Function doUnitTest(TestData as String, Driver as String) as String
Rem Ensure object assignment is by reference
Rem when object member is used ( as lhs )
Rem This time we are testing assigning with special Nothing
Rem keyword
Set cn = New ADODB.Connection
Dim conStr As String
conStr = "Provider=MSDASQL;Driver={" & Driver & "};DBQ="
conStr = conStr & TestData & "; ReadOnly=False;"
cn.Open conStr
Set objCmd = New ADODB.Command
objCmd.ActiveConnection = Nothing
if objCmd.ActiveConnection Is Nothing Then
doUnitTest = "OK" ' no error
Else
doUnitTest = "Fail - expected objCmd.ActiveConnection be Nothing"
End If
End Function