Commit Graph

594 Commits

Author SHA1 Message Date
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 61f794184e
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 15:20:25 2021 +0100

    added python version for second part of testcase

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

    reworked comment in fixed code

commit 5a94bcc481
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 36603f3c8d
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 1f20ea00d2
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 14:39:19 2021 +0100

    adapted testcase

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

    fixed test

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

    C99 compatible comments

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

    added extra checks to prevent accidental partial matches

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

    minor

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

    cleanup

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

    cleanup

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

    cleanup

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

    removed ide files

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

    removed printf

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

    possible fix found

commit 6fad8d40e3
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 72a7693340
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 1b53312c07
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Wed Mar 17 22:28:19 2021 +0100

    more notes (to be reverted)

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

    some experiments (to be reverted)

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

    added some notes

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

    comment changed

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

    renamed example template parameters to easily distinguish them.

commit ff457d7397
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 617bbde3b4
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Tue Mar 16 20:47:41 2021 +0100

    adjusted test for simple templates

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

    added note how it should be...

commit 7b3328431c
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 46c2443d15
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 16:11:56 2021 +0100

    unitests: reset parser for each testcase

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

    first experiment with templates

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

    wip

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

    integrated unittests in ctest

commit 79f7bee168
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 345d503d55
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:08:09 2021 +0100

    cleanup test code

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

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

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

    experiments

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

    first experiment

commit 7d26586105
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
John McFarland 85a4c7ffc0 Doxygen comment parsing fix for empty lines in code/verbatim blocks
Fix how end of paragraph is identified when parsing \code and
\verbatim blocks that appear within a paragraph and contain an empty
line.  Previously this would generate a warning for unexpected end of
doxygen comments, and it could generate a segfault due to
dereferencing an invalid iterator value.

The doxygen_basic_translate.i and doxygen_basic_translate_style2.i
tests have been updated to serve as regression tests for this
behavior.  Prior to this fix, inclusion of the empty code block line
in this context produced a segfault.
2019-07-06 11:30:46 -05:00
Isaac Pascual Monells 84e310402a Add nested_inheritance_interface test 2019-07-02 12:57:16 +02:00
William S Fulton 1204297a1b Merge branch 'doxy/space'
* doxy/space:
  Ensure empty line before code and math blocks in doxygen pydoc
  Remove extra newline before code block in doxygen python output
  Clarify python doxygen code block indentation handling
  Cleanup of pydoc translator newline trimming
  Correction to recently added doxygen python test case
  Adjust expected python output for doxygen style2 test
  Adding test for second doxygen comment style
  Fix bug in doxygen python code block indent
  Eliminate extra newlines around doxygen python block math
  Eliminate extra newlines in doxygen python \verbatim blocks
  Remove extra newline from end of doxygen python \code command
  Remove extra newline in beginning of doxygen python \code command
  Fix python doxygen indentation for inline \code command
2019-06-28 19:50:39 +01:00
John McFarland daad5d664d Ensure empty line before code and math blocks in doxygen pydoc
Sphinx requires an empty line before code and math blocks, whereas
doxygen does not.  This update ensures that a blank line is included
before generated code and math blocks in the pydoc output.  This is
done by post-processing the docstring line by line to check whether
any newlines need to be added.  This way, if the original doxygen
source already includes an empty line before a block, an additional
unnecessary empty line is not added.

Updating the expected test output for doxygen_basic_translate, which
now adds the necessary empty line before the code block.  Adding
further test cases to doxygen_translate_all_tags to explicitly verify
that a newline is added in the pydoc output before both code and math
blocks that appear within a paragraph.

Additionally, empty lines previously appearing at the beginning of the
generated docstrings are now removed.  This does not alter the
behavior of the tests.
2019-06-18 17:12:08 -05:00
Brad Kotsopoulos 55e835e0ae Java std::vector constructor performance improvement
Reserve before loop of push_back
Refactor li_std_vector testcase

This is a squash merge of #1552
2019-06-06 19:29:11 +01:00
John McFarland 91a90b8d27 Adding test for second doxygen comment style
This style looks like:

/** Line 1
 *  Line 2
 */

This is needed to verify fixes to some of the indentation in the
translated comments.

The test is copied from doxygen_basic_translate.i.  One adjustment was
made to change the comment style on the last function that left out
the intermediate "*" characters.  This does not produce correct output
when combined with this style of starting the text on the first
comment line.

Test results are copied directly from doxygen_basic_translate.  A
minor difference in the Python results will be updated in a subsequent
commit.
2019-05-25 16:25:54 -05:00
etse 3359b4ccab Applying shared_ptr template upcast fix to CSharp, adding CSharp test, and cleanup 2019-05-06 15:30:54 -04:00
etse 24f974bb0c 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 2019-05-06 15:30:54 -04:00
William S Fulton fbed720b98 Merge branch 'enum-trailing-comma-doxygen'
* enum-trailing-comma-doxygen:
  Fix parsing of enums with trailing comma with -doxygen
2019-04-24 08:08:18 +01:00
Vadim Zeitlin 74adaa5738 Fix parsing of enums with trailing comma with -doxygen
To correctly parse Doxygen post-comments after the trailing comma,
switch to right recursion in "enumlist" production rule definition: this
does consume more stack space when parsing, but makes the rules much
easier to write and to understand and hopefully shouldn't result in any
problems with real code (which shouldn't have thousands of enums items
in it).

Closes #1514.
2019-04-20 13:52:56 +02:00
Vadim Zeitlin 01a2cd27e7 Don't crash if type is not available in Python Doxygen code
Fix crash if "@return" Doxygen tag was used on a node without any return
type (such as a class, for example). Ignoring it might not be the best
thing to do, but it's definitely better than crashing and it's not
really clear what else could be done anyhow.

Closes #1516.
2019-04-20 13:52:05 +02:00
William S Fulton 4e5d1891e6 testcase fixes for gcc-9 2019-04-15 23:25:53 +01:00