Commit graph

606 commits

Author SHA1 Message Date
William S Fulton
34c219b5f7 Merge branch 'imfunc'
* imfunc:
  Add special variable imfuncname expansion for C# and D
  Test and document imfuncname special variable expansion
  Update docs.
  Also expose  in proxyClassFunctionHandler
  Expose  to javaout typemaps.

Conflicts:
	CHANGES.current
2022-05-30 19:45:28 +01:00
William S Fulton
62e0685df6 Test and document imfuncname special variable expansion 2022-05-30 19:00:04 +01:00
William S Fulton
15d69ec270 Add runme.class file to Java test-suite clean 2022-05-07 08:17:48 +01:00
Olly Betts
1aeaa2a644 Recognise and ignore Doxygen group commands @{ and @}
Fixes #1750
2022-04-07 12:05:54 +12:00
William S Fulton
0b15740663 Fix warning in D test-suite 2022-03-28 19:30:47 +01:00
William S Fulton
5cc4591ae7 Consistent cpp11 testing in test-suite
Move HAVE_CXX11 into makefiles so that running test-suite
from top level directory or in the language's test-suite directory
is consistent. For example, running 'make check-java-test-suite'
behaves the same as 'cd Examples/test-suite/java && make check'.
2022-03-27 19:34:20 +01:00
William S Fulton
598736a6b2 %interface family of macros no longer add variable wrappers
The getter/setter methods used for wrapping methods are no longer
added to the interface class.

Closes #1524

Also add in testcase for enums.
2022-03-12 23:04:24 +00:00
William S Fulton
b6ece11fc1 Fixes for the family of %interface macros for overloaded methods
When C++ methods are not able to be overloaded in a derived class,
such as when they differ by just const, or the target language
parameters types are identical even when the C++ parameter types
are different, SWIG will ignore one of the overloaded methods with
a warning. A %ignore is required to explicitly ignore one of the
overloaded methods to avoid the warning message. Methods added
in the derived classes due to one of the %interface macros are now
similarly ignored/not added to the derived class.

The adding of additional methods into the parse tree is now more
robust and complete resulting in support for %feature and %rename
for the added methods.

Closes #1277
2022-03-12 23:04:24 +00:00
William S Fulton
50518d4e77 Using declarations, directors and overloaded methods
Language::unrollVirtualMethods was assuming that the using
declaration would only introduce one method. Fix this by adding
in all the overloaded methods from a base class.

Affects code generation in C# and Java, but I was not able
to construct a test that failed before this commit.
2022-03-10 22:18:23 +00:00
William S Fulton
8e4868af75 More director const std::string& testing and C# leak fix
Issue #998
2022-02-13 23:00:04 +00:00
William S Fulton
88f1389f80 director_property testcase for C# and Java
Testing std::string as director method parameter
2022-02-13 16:08:57 +00:00
William S Fulton
86eaf30735 director string testing additions
Add test for C# based on Java example to test strings in and out.
Memory cleanup for Java test.
2022-02-12 12:09:01 +00:00
Olly Betts
901d1fc061 Fix comment typo 2022-01-24 12:16:26 +13:00
William S Fulton
429288fa1c Fix Java %interface family of macros
when returning by const pointer reference

Closes #1987
2021-04-27 23:37:18 +01:00
Olly Betts
e44ac904c4 java: Remove duplicate li_std_map entry
It's in CPP_STD_TEST_CASES so no need for Java to specifically add
it to CPP_TEST_CASES.
2021-04-20 11:56:27 +12:00
Olly Betts
8cd98ec74e Eliminate use of fn in testcases
Fix cpp11_lambda_functions and rname to use fn1 instead of fn, since
fn is a reserved word as of PHP 7.4.
2021-03-30 11:01:51 +13:00
William S Fulton
b3bc87d551 template template parameters patch tidyup
- Document change in CHANGES file
- Minor tweaks and whitespace fixes in stype.c
- Enhance testcase
- Synchronise Java and Python runt test in testcase
2021-03-22 01:08:05 +00:00
William S Fulton
cbfc0d15b1 Fix handling of Template template parameters
Closes #1977
Fixes #1603

Squashed commit of the following:

commit 61f794184e127e4a4b46fb306b2dfea71f7cd7bb
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 15:20:25 2021 +0100

    added python version for second part of testcase

commit bb80e236b8a7033d1ee45e392352ec0539730db3
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 15:10:14 2021 +0100

    reworked comment in fixed code

commit 5a94bcc481ea1c068b62a3dbc6cbc2032c9896db
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 15:07:34 2021 +0100

    removed new unittests; I switched to the official test cases

commit 36603f3c8dd27ee7b27d4a40804a844e1964b5aa
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 15:05:33 2021 +0100

    removed new unittests; I switched to the official test cases

commit 1f20ea00d22e6c59edb9ae69d6bb31aacab09c4b
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 14:39:19 2021 +0100

    adapted testcase

commit ab492794c0f26a27761b205fe1d67e2e9aa1f5b6
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 14:29:10 2021 +0100

    fixed test

commit 9b5dd0c8f9b110a3492753b466e707d7f786c909
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 13:04:06 2021 +0100

    C99 compatible comments

commit 1a89425ac8c85d68c6af1974e07573b9468d421e
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 11:41:48 2021 +0100

    added extra checks to prevent accidental partial matches

commit 20e76f511ac139c8ea2a9a7fd89c29391579665f
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:42:56 2021 +0100

    minor

commit 0e383bbb764f9a019f62b9f620f80908dead50d2
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:41:45 2021 +0100

    cleanup

commit b644767121440c77f4caeb45f672e3c698ee9d78
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:39:43 2021 +0100

    cleanup

commit 2574468c0f9352040759e680214b40ee59b03650
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:38:35 2021 +0100

    cleanup

commit 9dc7f1ed30171649e8a70b12ff4f76d93e545074
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:35:28 2021 +0100

    removed ide files

commit a442a9df460c52d4dbf7adf8e4f0c5bc5ad3b0cf
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:32:36 2021 +0100

    removed printf

commit da4c6e91e3b70e72e89cf09dfabfef7416274637
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:29:02 2021 +0100

    possible fix found

commit 6fad8d40e36195be422d5822e6f49d610e3ab693
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:01:11 2021 +0100

    found difference between good/bad case... next: analyze why replacement did not work here...

commit 72a7693340358d2067e63c5489191917ccb818dd
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Wed Mar 17 22:43:08 2021 +0100

    ideintified location where the template-template type is inserted in the final type (with the missing specialization).

commit 1b53312c07ab0696d9cade144bdbad1c84ebf6a3
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Wed Mar 17 22:28:19 2021 +0100

    more notes (to be reverted)

commit a9a0b589389784e0e95dc6f9edd27c78a16b481d
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Wed Mar 17 22:19:16 2021 +0100

    some experiments (to be reverted)

commit 0e7a24bbd5944d6e4f5c96ffd03003465f6d80f5
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Wed Mar 17 21:46:20 2021 +0100

    added some notes

commit 2f77911a12a38735cadeb93223981f3a6d9e7450
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Tue Mar 16 22:01:01 2021 +0100

    comment changed

commit 2cb7213b06f9b912c0ba56350ec6c318edba1ffb
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Tue Mar 16 21:55:47 2021 +0100

    renamed example template parameters to easily distinguish them.

commit ff457d73977e05adf84b095bcfa1dccd21203c48
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Tue Mar 16 21:21:10 2021 +0100

    added reset parser functionality (required for unittests, to reset parser)

commit 617bbde3b4b3d9dd16d3a2d85041fc78a87ae81f
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Tue Mar 16 20:47:41 2021 +0100

    adjusted test for simple templates

commit beb7e7f77cedd4ecfa4165534781d417710aff7e
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Mon Mar 15 07:41:17 2021 +0100

    added note how it should be...

commit 7b3328431ce41f7ec05657c69d3cb1a886cb8437
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 17:07:24 2021 +0100

    found a place which is maybe problematic for the template_template problem (#1603)

commit 46c2443d15a6288318723b7e730687791475cf7b
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 16:11:56 2021 +0100

    unitests: reset parser for each testcase

commit b3a0f1516ffdbf9f0fbb2d8362e2375fd1893c3f
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 15:30:47 2021 +0100

    first experiment with templates

commit 32a11c6c77b840f11b9e926edd465e6a7108267f
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:31:17 2021 +0100

    wip

commit 37b805ba6eaadb4a34a929204d539f555f8313be
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:21:05 2021 +0100

    integrated unittests in ctest

commit 79f7bee168ecfbd2f2f5feeb9ca43fb7113bc2a4
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:18:26 2021 +0100

    wip: new test created; problem: not in c++ mode

commit 345d503d557d67fa431f528e637bac5816f50ab1
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:08:09 2021 +0100

    cleanup test code

commit 0a26adec10435af36bfad4e1f6a073460c63fbc6
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:05:24 2021 +0100

    some more tests (first steps with c++ code)

commit 6f628e0fa9e2659f5a7ca08b9954e81d4cd4f012
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 12:56:41 2021 +0100

    experiments

commit c4a13bf3e12cd83886cbc54e32194bf916a643d3
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 13 18:18:01 2021 +0100

    first experiment

commit 7d265861052f205d48b1ccec8ab0fe053de19858
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 13 17:23:13 2021 +0100

    setup catch2 framework (w/o tests)
2021-03-22 01:02:42 +00:00
William S Fulton
cf639b2794
Merge pull request #1909 from treitmayr/ruby-additional-tests
Add and improve Ruby test cases in the context of nesting and namespaces
2021-03-18 23:09:20 +00:00
William S Fulton
69f9509c2b Fix incorrect warning "Unknown Doxygen command: ." 2021-03-01 23:12:21 +00:00
Thomas Reitmayr
7963445048 Add and improve Ruby test cases in the context of nesting and namespaces
This is done in preparation for adding namespace support to the Ruby
part of SWIG. Some existing test cases were reorganized or duplicated
for flat/nonflat nesting. For some a Ruby test script was added.
Finally the ruby/Makefile.in was improved so that for test cases
without an explicit test script, the generated wrapper library will
be loaded by the Ruby interpreter to ensure loading works fine.
2020-12-16 22:30:46 +01:00
William S Fulton
991c2afe11 Merge branch 'python-doxygen-quotes'
* python-doxygen-quotes:
  Fix generated Python code for Doxygen comments with triple quotes
  Fix generated Python code for Doxygen comments ending with quote
2020-06-07 10:23:33 +01:00
John McFarland
61dbc4b50c Fix for missing space after \endlink in doxygen
The "endlink" command is processed in processWordCommands, which by
default skips space occuring after the command, which is intended for
removing leading space from a command argument.  For "end" commands,
we don't want to do this.  Note that certain end commands such as
"endcode" aren't processed by processWordCommands (believe
addCommandUnique ends up handling them).

Update usage of \link in doxygen_translate_all_tags.i to test handling
of space after \endlink.

Tweaking some of the usage in doxygen_misc_constructs.i to remove what
seems to be an extra space from the input (otherwise we would need to
add an extra space to the expected output).
2020-05-02 18:42:55 -05:00
Vadim Zeitlin
f57b096c92 Fix generated Python code for Doxygen comments with triple quotes
In addition to the changes in the previous commit, also avoid syntax
errors in the generated Python docstrings by splitting them into several
parts if there are 3 quotes in a row in the input, as it's impossible to
have them inside triple-quoted strings, generally speaking (i.e. if
there are occurrences of both """ and ''' inside the string).
2020-03-04 00:57:31 +01:00
Vadim Zeitlin
b81cd1bdab Fix generated Python code for Doxygen comments ending with quote
Single-line Doxygen comments ending with a double quote resulted in
syntactically-invalid Python docstrings in the output, so use triple
single quotes as delimiters in this case to avoid it.
2020-03-04 00:56:27 +01:00
William S Fulton
6910e5f09c Merge branch 'shared-ptr-template-upcast'
* shared-ptr-template-upcast:
  comments
  Applying shared_ptr template upcast fix to CSharp, adding CSharp test, and cleanup
  Adding test case demonstrating issue where SWIG does not generate a correctly typed, upcasted shared_ptr for a template instantiation deriving from a base class
  WIP - Use the non-encoded type string for upcasting a shared_ptr of a derived type to a shared_ptr of the base type
  comments
  Applying shared_ptr template upcast fix to CSharp, adding CSharp test, and cleanup
  Adding test case demonstrating issue where SWIG does not generate a correctly typed, upcasted shared_ptr for a template instantiation deriving from a base class
  WIP - Use the non-encoded type string for upcasting a shared_ptr of a derived type to a shared_ptr of the base type
2020-01-17 18:45:30 +00:00
William S Fulton
bdc9aa0038 Update anther newly merged doxygen Java test for Java 9 API
See 66a7826192
2020-01-16 19:30:44 +00:00
William S Fulton
aa59c81205 Merge branch 'Issue-1643'
* Issue-1643:
  Fix pydoc null pointer dereference with missing arg type
2020-01-16 18:54:47 +00:00
William S Fulton
55d36e3fd3 Merge branch 'Issue-1632'
* Issue-1632:
  Minor workaround in doxygen_basic_translate_style3 test
  Add new test doxygen_basic_translate_style3.i
  Fix for newline handling in doxygen "///" style comments
2020-01-16 07:19:29 +00:00
William S Fulton
9cfeb592ed Remove unused import in java testcase 2020-01-15 22:17:18 +00:00
William S Fulton
d1a4174bf3 Fix deprecation warning in java testcase
Fixes:
./director_string_runme.java:53: warning: [deprecation] Integer(int) in Integer has been deprecated
2020-01-14 20:02:15 +00:00
William S Fulton
af504ccddd Update newly merged doxygen Java test for Java 9 API
See 66a7826192
2020-01-14 18:43:58 +00:00
William S Fulton
00b47d4d1d Merge branch 'doxy/commands'
* doxy/commands:
  Update documentation for doxygen tags
  Fix doxygen translation of \p command for python
  Fix doxygen handling of \em tag for python
  Minor formatting updates to doxygen docs
  Reformat tag lists in doxygen documentation
  Add doxygen_code_blocks_runme.java
  Special handling for python doctest code blocks
  Add new doxygen test doxygen_code_blocks
  Handle doxygen code command with language option
  Improve doxygen parser handling of \code content
  Flag optional arguments in doxygen pydoc output
  Add parameter direction to doxygen pydoc output
  Support doxygen \param[] commands
2020-01-14 18:36:50 +00:00
Vadim Zeitlin
b52af40398 Disable Doxygen tests when using Java 8 or older
Check Java version in configure and define SKIP_DOXYGEN_TEST_CASES if
it's less than 9, which is required by the new implementation of
CommentParser used in the Doxygen tests.
2019-12-18 16:24:28 +01:00
Vadim Zeitlin
66a7826192 Rewrite Doxygen unit tests for Java using Java 9 API
In particular, do not use com.sun.javadoc deprecated since Java 9 and
finally removed in Java 13, to allow the tests to run under modern JRE.

They don't run under Java 8 and earlier any more, but this shouldn't be
a huge problem nowadays and as SWIG output is independent from the Java
version used, it's enough to test it with modern Java versions.

Note that the tests themselves were changed only in the most minimal
way, to adapt them to the new way of running javadoc (which is now also
integrated into CommentParser itself instead of being duplicated in
every test).
2019-12-18 02:45:06 +01:00
Vadim Zeitlin
5a8875ca9d Don't crash if unexpected comment is found in Java Doxygen tests
Don't pass null pointer to BufferedWriter.write(), as this results in
NullPointerException.
2019-12-18 02:26:03 +01:00
Vadim Zeitlin
fe6968e5e2 Reuse existing variable in CommentParser code used in Java tests
No real changes, just a tiny simplification.
2019-12-18 02:24:01 +01:00
John McFarland
e46e1655cd Minor workaround in doxygen_basic_translate_style3 test
With the "///" doxygen comment style, comments within a code block do
not get handled correctly.  Modifying the test to remove this case and
adding a note about it for future reference.
2019-11-02 10:43:52 -05:00
John McFarland
feea39f352 Add new test doxygen_basic_translate_style3.i
This is used to test the "///" style of doxygen comments.  Previously,
newlines in these doxygen comments were not handled correctly.
2019-11-02 10:43:52 -05:00
John McFarland
f99eb0058b Fix pydoc null pointer dereference with missing arg type
Processing doxygen @param comments for a parameter whose name did not
appear in the function declaration would cause a segfault due to a
null pointer dereference.

Adding test cases for both variadic function (no specified arguments)
and @param comment that references an argument that is not named in
the function prototype.  Both of these cases previously segfaulted.
2019-10-27 18:19:42 -05:00
John McFarland
08ff05c14c Add doxygen_code_blocks_runme.java
The code blocks test is intended to test code block language options
and python doctest translation that is supported for Python, but the
doxygen constructs are still recognized when translating comments for
Java (it is just that the code language option is not used).
2019-08-21 08:43:12 -05:00
John McFarland
eb11c025c7 Support doxygen \param[] commands
Recognize \param[in], \param[out], and \param[in,out].  Currently they
are all treated the same as \param, but the information is now
available for inclusion in the translated comments.  This is done
using new utility functions getBaseCommand and getEndOfWordCommand,
which will also generalize to treatment of code command options,
e.g. \code{.py}.  Preliminary treatment of the extended version of
\code is already in place in these functions.

Added examples of all three new \param commands to the
doxygen_translate_all_tags test and updated the python and java
expected output.
2019-08-07 16:42:24 -05:00
William S Fulton
1e66c13abd Merge branch 'csharp-set-fixes'
* csharp-set-fixes:
  Fix std::vector<> Java typemaps for primitive types
  Allow std::set<> C# typemaps to work for non-nullable types too
  Replace leftover string with the proper type in C# set typemap
2019-07-12 08:13:19 +01:00
Vadim Zeitlin
c321aca2b4 Fix missing value for first item of enums with trailing comma
The value of the first item of an enum with a trailing comma after its
last item was not correctly initialized to 0 any more after the changes
of 74adaa5738 (see #1515) because "_last"
attribute was not set correctly in this case.

Do set it for the last item when it's followed by a comma too and add
more unit tests checking for this.

Closes #1566.
2019-07-11 17:15:38 +02:00
Vadim Zeitlin
2be293a647 Fix std::vector<> Java typemaps for primitive types
For such types, the generated proxy class inherited from
java.util.AbstractSet<BoxedType<T>> (where BoxedType<T> is "Integer",
for example, when T is "int"), but defined an overloaded add() taking T,
instead of overriding the base class virtual add() taking BoxedType<T>,
resulting in an exception being thrown whenever add() was called during
run-time.

Extend Java unit test to bring it to parity with C# one added in the
previous commit.

See #1568.
2019-07-11 13:10:23 +02:00
Vadim Zeitlin
53d75dc133 Replace leftover string with the proper type in C# set typemap
This is just a mistake remaining from generalizing the old
string-specific typemap to any type.

Fix it now and update a unit test to test for sets of objects other than
strings.
2019-07-11 12:49:17 +02:00
William S Fulton
42f5e2da41 Merge branch 'doxy/segfault'
* doxy/segfault:
  Add iterator safety check in DoxygenParser::parse
  Doxygen comment parsing fix for empty lines in code/verbatim blocks
2019-07-11 07:08:51 +01:00
William S Fulton
aea7a6d30f Merge branch 'patch-1'
* patch-1:
  nested_inheritance_interface testcase enhancement
  Add nested_inheritance_interface test for csharp
  Fix class name for nested classes
  Add nested_inheritance_interface test
  Fix class name for nested classes

Conflicts:
	CHANGES.current
2019-07-09 19:37:35 +01:00
William S Fulton
20d96531e3 nested_inheritance_interface testcase enhancement
Fixes unused variable reported by C# compiler and enhance test slightly
2019-07-09 19:36:46 +01:00
William S Fulton
75c5cb7458 gcc-9 testcase warning fix
warning: ‘new’ of initializer_list does not extend the lifetime of the
underlying array [-Winit-list-lifetime]
2019-07-09 08:06:18 +01:00