cid#1636693 COPY_INSTEAD_OF_MOVE
[LibreOffice.git] / basic / qa / vba_tests / ole_ObjAssignToNothing.vb
blob9a0a557cdf312e392504c51126aa82e12b85c10f
2 ' This file is part of the LibreOffice project.
4 ' This Source Code Form is subject to the terms of the Mozilla Public
5 ' License, v. 2.0. If a copy of the MPL was not distributed with this
6 ' file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 Option VBASupport 1
10 Function doUnitTest(TestData as String, Driver as String) as String
11 Rem Ensure object assignment is by reference
12 Rem when object member is used ( as lhs )
13 Rem This time we are testing assigning with special Nothing
14 Rem keyword
15 Set cn = New ADODB.Connection
16 Dim conStr As String
17 conStr = "Provider=MSDASQL;Driver={" & Driver & "};DBQ="
18 conStr = conStr & TestData & "; ReadOnly=False;"
19 cn.Open conStr
20 Set objCmd = New ADODB.Command
21 objCmd.ActiveConnection = Nothing
22 if objCmd.ActiveConnection Is Nothing Then
23 doUnitTest = "OK" ' no error
24 Else
25 doUnitTest = "Fail - expected objCmd.ActiveConnection be Nothing"
26 End If
27 End Function