Bug 84098 - kill copy+paste in VBA tests ...
Summary: kill copy+paste in VBA tests ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.3.0.2 rc
Hardware: Other All
: medium normal
Assignee: George Bateman
URL:
Whiteboard: target:7.2.0 target:7.3.0
Keywords: difficultyMedium, easyHack, skillCpp, topicCleanup
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2014-09-19 13:59 UTC by Michael Meeks
Modified: 2021-07-02 15:50 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meeks 2014-09-19 13:59:12 UTC
Existing VBA tests in basic/qa/vba_tests involve a depressing amount of cut/paste coding - in particular of:

Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
...

and:

Dim passCount As Integer
Dim failCount As Integer
Dim result As String

It would be great to create two other small files for these:

sharedVariables.vb
testAsserts.vb

And to tweak:

basic/qa/cppunit/test_vba.cxx

to substitute these into all the other .vb files so we have a consistent set.

It'd be nice to get the OnError handling good too eg.

    TestLog_ASSERT (False), "hit error handler - " & Err & ": " & Error$ & " (line : " & Erl & ")"

So it prints the actual error / line numbers etc. And of course the body of:

Function doUnitTest() As String
    result = verify_win32compat()
    If failCount <> 0 Then
        doUnitTest = result
    Else
        doUnitTest = "OK"
    End If
End Function

To reduce cut/paste to the maximum =)

I'd suggest using %%include sharedvariables.vb%% or somesuch syntax - you'll need to invent that, there is no pre-proc in VBA =) and impl. it in the unit test.

Thanks !
Comment 1 Rosemary Sebastian 2015-07-21 09:58:55 UTC
Hello! I'm starting work on this bug.
Comment 2 Robinson Tryon (qubit) 2015-12-10 11:40:56 UTC Comment hidden (obsolete)
Comment 3 Robinson Tryon (qubit) 2016-02-18 14:52:26 UTC Comment hidden (obsolete)
Comment 4 Marc Antoine Dumont 2016-10-24 19:08:53 UTC
I would like to start to work on this issue.
Comment 5 jani 2016-10-24 19:11:51 UTC
(In reply to Marc Antoine Dumont from comment #4)
> I would like to start to work on this issue.

Welcome, please assign it to yourself.

here is a step by step guide to help you get started:
https://wiki.documentfoundation.org/Development/GetInvolved
Comment 6 jani 2016-10-29 08:32:34 UTC
change status
Comment 7 jani 2016-11-29 07:07:00 UTC
A polite ping, still working on this issue ?
Comment 8 jani 2017-01-09 08:27:07 UTC
Unassing, due to lack of work...if you still work on it, please assign it again.
Comment 9 Ekansh Jha 2018-01-11 17:47:30 UTC
Hello, I would like to work on this issue. I am confused about the contents
that the above two mentioned files " sharedVariables.vb testAsserts.vb"
will contain.
Comment 10 George Bateman 2020-12-16 22:33:47 UTC
I have got this working in https://gerrit.libreoffice.org/c/core/+/107860 if someone would like to review it.
Comment 11 Commit Notification 2020-12-19 22:40:48 UTC
George Bateman committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/73ba462935a217a2b2d5ad296679d54f42f4b1ba

tdf#84098 kill copy+paste in VBA tests

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Andreas Heinisch 2020-12-21 08:17:45 UTC
Thank you for the patch! Great work and saves a lot of time!

A small question: in basic/qa/vba_tests/_test_asserts.vb there is Option VBASupport 1 and there exists a bug, where VBASupport=1 is erroneously inherited (https://bugs.documentfoundation.org/show_bug.cgi?id=132347).

Do we have the same situation here, which affects all the test without VBASupport 1?
Comment 13 Commit Notification 2020-12-22 05:19:10 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/66b135fa80452144baf57e91a6814b172f8174e2

Related: tdf#84098 Unify tests

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 George Bateman 2020-12-26 18:58:52 UTC
(In reply to Andreas Heinisch from comment #12)
> Thank you for the patch! Great work and saves a lot of time!
> 
> A small question: in basic/qa/vba_tests/_test_asserts.vb there is Option
> VBASupport 1 and there exists a bug, where VBASupport=1 is erroneously
> inherited (https://bugs.documentfoundation.org/show_bug.cgi?id=132347).
> 
> Do we have the same situation here, which affects all the test without
> VBASupport 1?

Hi Andreas,

Yes the bug is relevant. If I adapt the sample in https://bugs.documentfoundation.org/show_bug.cgi?id=132347, using StrComp, then the bug appears. However all the tests in vba_tests use VBASupport 1 anyway so this is not a practical problem at the moment.

George
Comment 15 Xisco Faulí 2021-03-31 13:57:19 UTC
Hi Michael Meeks,
Can we call this bug fixed or is there still something to be done ?
Comment 16 Michael Meeks 2021-03-31 13:58:34 UTC
All looks beautiful to me, lets close it - thanks Xisco =)
Comment 17 Commit Notification 2021-07-02 15:50:49 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a6178d172ebc47c623b1c1435d4c2e24966fce56

tdf#84098 kill copy+paste in basic/qa/basic_coverage

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.