Commit Graph

75 Commits

Author SHA1 Message Date
Mike Kaganski
66b135fa80 Related: tdf#84098 Unify tests
Shorten the tools module name; use TestUtil.AssertEqual where applicable;
remove unnecessary variables that only made noise and masked what was
actually asserted; add missing licence headers.

Change-Id: If891ed8ceb38fed18335aad061b2b09d341264f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108118
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-22 06:18:50 +01:00
George Bateman
73ba462935 tdf#84098 kill copy+paste in VBA tests
Move repeated code into _test_asserts.vb

Change-Id: Idfe124a8dbab4925309fa5f1322e0cce5f097b7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107860
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-19 23:40:13 +01:00
LibreOfficiant
45435e2ac0 VBA Err object raise method TestCases
Err.Raise(#) enables 'User-Defined Exceptions' 

Std Basic alternative is: Error # 'without  parentheses
which throws pre-defined error codes. 

Change-Id: I76229b237066e33229d4d13e6742c660887fda2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85017
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-03-24 11:16:21 +01:00
Andreas Heinisch
8e323fcace tdf#36737 - Initialize default values of optionals
Initialize default values of optionals in function headers.

In LO Basic, optional parameters are allowed, but without
any default values. Missing parameters will not be initialized
to their respective default values of its datatype, either.

With option Compatible, optional parameters are allowed
with default values. Missing optional parameters that
don't have explicit default values will not be initialized
to their default values of its datatype.

With option VBASupport, optional parameters are allowed with
default values. Missing optional parameters that don't have
explicit default values will be initialized to their default
values of its datatype.

Change-Id: I57aabae5f70d1cf6c4e8feb95ce0db6af753383c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87550
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-03-02 10:08:58 +01:00
LibreOfficiant
4171b99905 VBA Enum statement TestCases
Change-Id: Ib8f730d22bc7de00736c9fb1bb9c1af1784eb5df
Reviewed-on: https://gerrit.libreoffice.org/85074
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-12-14 10:40:29 +01:00
lbenes
1b83d562fb fix windows builds after commit 7ddedd2594
Change-Id: I2990da77a91f6c8fdb6fd9e4112d0451bc3342da
Reviewed-on: https://gerrit.libreoffice.org/82547
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-11-13 09:30:46 +01:00
Gabor Kelemen
7ddedd2594 tdf#42949 Fix IWYU warnings in basic/
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I325149be2ea7697b5b4a2ce4a662edd2f8be6e50
Reviewed-on: https://gerrit.libreoffice.org/82312
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-11-12 09:20:55 +01:00
Stephan Bergmann
e1e39fac22 Some more WIN32 -> _WIN32
...at least some of which have presumably been missing from
ce43d0ae92 "use consistent #define checks for the
Windows platform" by accident (and some just clean up comments)

Change-Id: I5532685c7df96ae3c8a25b73d8064d7433964a9b
Reviewed-on: https://gerrit.libreoffice.org/68580
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2019-03-01 17:40:47 +01:00
Tamás Zolnai
afbfe42e63 clang-tidy: (WIP) bugprone-too-small-loop-variable findings 2
Change-Id: I1ddf3fe0e5fad265ae14712a23469b684253079d
Reviewed-on: https://gerrit.libreoffice.org/63241
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2018-11-10 23:11:28 +01:00
Mike Kaganski
59d53910de Small cleanup and simplification
Change-Id: I1e8a750832f365f080f6f60c81560dc942003049
Reviewed-on: https://gerrit.libreoffice.org/56788
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-07-02 06:34:43 +02:00
Zdeněk Crhonek
c5417a21f5 VBA tests (4) - don't pass when all tests fail
Change-Id: Ib4f9b5df1cffe104ba27be95183d075f24f28bb3
Reviewed-on: https://gerrit.libreoffice.org/45774
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-12-23 12:48:39 +01:00
Zdeněk Crhonek
baaf6c12c8 VB tests (3)-don't pass whe all tests fail
Change-Id: I7dd99a43a3d41c8ca31a070028a19bd032d06435
Reviewed-on: https://gerrit.libreoffice.org/45739
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-12-22 00:04:01 +01:00
Tor Lillqvist
66b3970c94 Seems that testMiscOLEStuff() works only as 64-bit on a current Windows 10
Change-Id: Ib43f8c185d2a2e9e93f34d918d6f9461586cf6a6
2017-10-17 18:57:54 +03:00
Mike Kaganski
1944e3ddc0 Rename and move SAL_U/W to o3tl::toU/W
Previosly (since commit 9ac98e6e34)
it was expected to gradually remove SAL_U/W usage in Windows code
by replacing with reinterpret_cast or changing to some bettertypes.
But as it's useful to make use of fact that LibreOffice and Windows
use compatible representation of strings, this commit puts these
functions to a better-suited o3tl, and recommends that the functions
be consistently used throughout Windows-specific code to reflect the
compatibility and keep the casts safe.

Change-Id: I2f7c65606d0e2d0c01a00f08812bb4ab7659c5f6
Reviewed-on: https://gerrit.libreoffice.org/43150
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-05 16:02:52 +02:00
Mike Kaganski
c3609f107b Use SAL_W/SAL_U instead of reinterpret_cast btwn wchar_t* and sal_Unicode*
This is type-safe, and allows to catch cases where a source type
is changed for some reason, but reinterpret_cast masks that

Change-Id: Ib64b6fa2e22d94a6bba890f0ccc3e20325c6f0a1
Reviewed-on: https://gerrit.libreoffice.org/42961
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-30 19:08:28 +02:00
Mike Kaganski
aaa26a58ba Some more WIN32_LEAN_AND_MEAN
Change-Id: Iadb0ebb66809c192fb817b8c7cf2f8cdb4d0b874
Reviewed-on: https://gerrit.libreoffice.org/42419
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-18 19:24:31 +02:00
Zdeněk Crhonek
74da6d5f9f VBA tests-add VAL,VARTYPE,WEEKDAY,WEEKDAYNAME,YEAR tests
Change-Id: I3f1803617a2bdeaab9922ebb375ec4fd67318d20
Reviewed-on: https://gerrit.libreoffice.org/41499
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-08-24 12:55:26 +02:00
Zdeněk Crhonek
57ece564ac VBA functions tests-SYD, TIMESERIAL, TIMEVALUE, TRIM, TYPENAME, UBOUND,UCASE
Change-Id: I7ea7757291d996375584ef05d822701737020b1c
Reviewed-on: https://gerrit.libreoffice.org/40894
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-08-08 19:36:00 +02:00
Zdeněk Crhonek
f060d64507 VBA tests- add functions STRING,STRREVERSE,SWITCH
Change-Id: Ibba3b5cabee31af44f0e8dda5a11f152ab0cfe01
Reviewed-on: https://gerrit.libreoffice.org/40730
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-08-03 21:29:30 +02:00
Zdeněk Crhonek
3acfc281ad VBA tests - STR and STRCOMP functions
Change-Id: I09daaa8be3687bf838f569849542d47c85907d1e
Reviewed-on: https://gerrit.libreoffice.org/40687
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-08-02 21:51:55 +02:00
Zdeněk Crhonek
fae4b84882 VBA tests-functions RIGHT,RTRIM,SECOND,SGN,SIN,SLN,SPACE,SQR
Change-Id: I0db9233f20fccbc4b2c4f4b3e36cf0aaa8583c99
Reviewed-on: https://gerrit.libreoffice.org/40339
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-07-24 18:05:44 +02:00
Zdeněk Crhonek
ad17c13cf1 VBA test - add RATE, RGB functions
Change-Id: I284597a54067049479c56d6e6eea6322f0e3ee2b
Reviewed-on: https://gerrit.libreoffice.org/39377
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-06-29 15:51:42 +02:00
Zdeněk Crhonek
f15afbcbb2 add VBA tests- PMT, PPMT, PV,QBCOLOR functions
Change-Id: Idcbecbdee6a6c054886d6a11ce22e525ecf23736
Reviewed-on: https://gerrit.libreoffice.org/38084
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-05-27 21:01:06 +02:00
Takeshi Abe
f060adefba Test _WIN32 instead of WIN32
since the former is predefined by Visual C++ [0], but the latter
is not.

[0] https://msdn.microsoft.com/en-us/library/b0084kay.aspx

Change-Id: I9ecb84779cbaf5f0186ef0b05da61b32293f8f2b
Reviewed-on: https://gerrit.libreoffice.org/37808
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2017-05-22 22:00:47 +02:00
Takeshi Abe
666901bc82 basic: Test VBA's CDec() only on Windows
since it is not implemented on others.

Change-Id: If058207eb441caa65f93bbb554fe77cf469b1682
Reviewed-on: https://gerrit.libreoffice.org/37631
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-05-16 05:19:17 +02:00
Takeshi Abe
f99c95c80d basic: Fix VBA constant vbNewLine with unit test
... making its value CRLF on Windows and LF on others.

A winding road of regressions passed through it;
first b680e35254,
then 7beeced463.

Change-Id: I9e4da4a17436949b4fea35481b8355b4321cb268
Reviewed-on: https://gerrit.libreoffice.org/37500
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-05-15 04:57:59 +02:00
Zdeněk Crhonek
3cb581adde VBA tests- MONTHNAME,NPER, NPV,OCT test case
Change-Id: Ia6c732d4c205ba2461007feacce1403b83e6043b
Reviewed-on: https://gerrit.libreoffice.org/37109
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-05-03 20:14:27 +02:00
Stephan Bergmann
38f70cd770 loplugin:cppunitassertequals: basic
Change-Id: Icaa3e0eace6ccff365d4ebdb007771fc8a78671a
2017-04-28 14:21:30 +02:00
Zdeněk Crhonek
377d2d4bed add VBA test cases
functions  - LEFT, LEN, LOG, LTRIM,
MID, MINUTE, MIRR, MONTH

Change-Id: Ifa4c6c1b715772644afc4280379b2a9e8429842f
Reviewed-on: https://gerrit.libreoffice.org/36551
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-04-16 18:01:59 +02:00
Zdeněk Crhonek
31dc11e7e3 add VBA test cases
tests:  ISARRAY, ISDATE, ISEMPTY, ISERROR, ISMISSING,
ISNULL, ISNUMERIC, ISOBJECT, JOIN, LBOUND, LCASE

Change-Id: I0b0dacd0d62bf00680f33866ce7ec0152eec27e0
Reviewed-on: https://gerrit.libreoffice.org/36509
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-04-13 14:22:23 +02:00
Zdeněk Crhonek
ed4473abc1 VBA tests - INSTRREV, INT test case
Change-Id: I220b8dd57927486b697b46777e20db7d2f53e487
Reviewed-on: https://gerrit.libreoffice.org/36486
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-04-13 09:54:18 +02:00
Stephan Bergmann
c14ed11d77 Clean up uses of SAL_U/SAL_W: basic
Change-Id: I755b3b781c42cc9af61c0b90621d2eb7f544df62
2017-04-10 10:13:41 +02:00
Zdeněk Crhonek
d89a421352 VBA tests - HEX, HOUR, IIF, INSTR test cases
Change-Id: Ib9e05dcfbd72f56cb3b5fb4e4760f868c008c7ac
Reviewed-on: https://gerrit.libreoffice.org/36315
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-04-09 15:42:50 +02:00
Zdeněk Crhonek
6c34c5ff46 VBA tests - FORMATNUMBER function
Change-Id: Ibfb00e5be9a32e3767ec4e73cdbf81f53f07b42e
Reviewed-on: https://gerrit.libreoffice.org/36229
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-04-09 07:27:05 +02:00
Stephan Bergmann
9ac98e6e34 Finally switch MSVC to sal_Unicode = char16_t, too
There is lots of (Windows-only) code that relied on sal_Unicode being the same
as wchar_t, and the best change may be different in each case (and doing the
changes may be somewhat error prone).  So for now add SAL_U/SAL_W scaffolding
functions to sal/types.h, remove their uses one by one again, and finally drop
those functions again.

Change-Id: I2cc791bd941d089901abb5f6fc2f05fbc49e65ea
Reviewed-on: https://gerrit.libreoffice.org/36077
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-04-04 16:12:11 +00:00
Zdeněk Crhonek
d9dc5dcd39 add VBA tests- FIX,EXP,ERROR,DAY functions
Change-Id: I339abf03f88a0b8135184a892f5200ad381310bd
Reviewed-on: https://gerrit.libreoffice.org/36010
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-04-02 11:02:27 +00:00
Zdeněk Crhonek
a2c746ecd8 VBA tests - add DATEDIFF and DATEPART test case
Change-Id: I3d0026e707369e435013be1d11e1366a77ff2d0b
Reviewed-on: https://gerrit.libreoffice.org/35881
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-03-29 21:01:48 +00:00
Zdeněk Crhonek
1e02750ef2 VBA tests - add CVDATE,CVERR,DATEADD test case
Change-Id: Ib6b79eb3a3daf22dd4f15427a3e8547300f8b8f9
Reviewed-on: https://gerrit.libreoffice.org/35403
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-03-18 16:26:09 +00:00
Zdeněk Crhonek
7ea2962e76 VBA tests - add CSNG, CSTR test case
Change-Id: I5e9bc24bb89cc634a3c01e8c8b23a19927e7010c
Reviewed-on: https://gerrit.libreoffice.org/35341
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-03-17 17:39:13 +00:00
Zdeněk Crhonek
c0ed8e9537 add VBA test CINT,CLNG functions tests
Change-Id: I69f0144006e4ed226e8b158c0cc9f60dda0a9184
Reviewed-on: https://gerrit.libreoffice.org/35060
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-03-11 06:16:58 +00:00
Zdeněk Crhonek
1577f01b29 add VBA COS function test case
Change-Id: I9014e068576d68613da6a70526dcb5b8e278e3f1
Reviewed-on: https://gerrit.libreoffice.org/35027
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-03-10 20:18:41 +00:00
Zdeněk Crhonek
8528712b6e VBA test CHOOSE function
Change-Id: Ieb76595199ea1f6c23924d4860228fe5f4d30df1
Reviewed-on: https://gerrit.libreoffice.org/34909
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-03-06 05:43:29 +00:00
Zdeněk Crhonek
ed0e8f970f VBA test CDATE, CDBL function
Change-Id: Id45930e6d329a0b1142bfde612c1a089390e4817
Reviewed-on: https://gerrit.libreoffice.org/34868
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-03-04 09:20:02 +00:00
Zdeněk Crhonek
38f13e4dca add VBA functions tests - ABS,ARRAY, ASC, ATN, CBOOL
Change-Id: I8a0b8b833ba32b9d27773748b3bbd8bbc07d1959
Reviewed-on: https://gerrit.libreoffice.org/34696
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
2017-03-01 05:16:52 +00:00
Zdeněk Crhonek
b5c83cf676 add VBA CHR() test case
Change-Id: I9e7aefdd0309fd4f209fba6fb4f698b098856d01
Reviewed-on: https://gerrit.libreoffice.org/34133
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
2017-02-27 20:37:36 +00:00
Noel Grandin
83721f4365 makeAny->Any in basctl..chart2
Change-Id: Ief1cdffbfc59ab4e35ac945d020772ff84c50d61
Reviewed-on: https://gerrit.libreoffice.org/33867
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-03 08:50:50 +00:00
Noel Grandin
4978328534 convert method names in tools::SvRef to be more like our other..
reference classes, uno::Reference and rtl::Reference.

Specifically rename Is()->is() and Clear()->clear().

Change-Id: Icb7e05e2d09cb9977121508b837ba0961dabb4ae
Reviewed-on: https://gerrit.libreoffice.org/33576
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-02 08:02:54 +00:00
Mike Kaganski
5ecd7ebbdf Partially fix VBATest::testMiscOLEStuff for Win64
On Windows x64 there are two ODBCs - one for each bitness.
A 64-bit build gets 64-bit ODBC, and there is no provider named
"Microsoft Excel Driver (*.xls)", no normally the test is simply
skipped. But if MS Excel is installed, then it installs provider
"Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)", that was
detected by previous code, but not used inside the VBAs. So, VBAs
tried to use "Microsoft Excel Driver (*.xls)" unavailable to them.

This patch allows using Excel's provider as well, thus allowing
developer to test against 64-bit-specific regressions.

However, the last test uses Microsoft.Jet.OLEDB.4.0 provider,
that is unavailable on Win64. There are substitutions -
Microsoft.ACE.OLEDB.12.0 and Microsoft.ACE.OLEDB.15.0,
but there is no easy way to test if they are installed. Thus,
that test is disabled on Win64 for now.

Also, possible buffer overflow fixed, when byte count was passed
to SQLGetInstalledDriversW instead of char count.

Change-Id: Ib5c55251f0e92b3078a46aee173b5061439445ae
Reviewed-on: https://gerrit.libreoffice.org/32019
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-14 19:03:56 +00:00
Stephan Bergmann
f338935019 loplugin:unnecessaryoverride (dtors) in basic
Change-Id: I5756b96bcc7563b82e35d3cdfdda3b80692767e5
2016-11-23 18:37:02 +01:00
Tor Lillqvist
f29ce347f9 Bypass VBATest::testMiscOLEStuff() in a 64-bit Windows build for now
It fails when Excel is installed, for some reason:

    Basic error:
    Type: com.sun.star.uno.RuntimeException
    Message: [automation bridge] unexpected exception in IUnknownWrapper_Impl::invoke ! Message :
    [automation bridge]: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    macro result for ole_ObjAssignNoDflt.vb
    macro returned:

    C:/cygwin64/home/Tor/lo/64bit-debug/basic/qa/cppunit/test_vba.cxx:155:`anonymous namespace'::VBATest::testMiscOLEStuff
    assertion failed
    - Expression: pReturn->GetOUString() == "OK"
    - Result not as expected

Note that this test returns early if Excel is not installed, so it is
not run effectively performed anyway even in 32-bit builds on most
(any?) Jenkins and tinderbox machines.

Change-Id: I0a0b6f27219dec116369fae1bb7c95b3e9597e77
2016-10-27 12:33:34 +03:00