Commit graph

5,302 commits

Author SHA1 Message Date
William S Fulton
4d5f4bcd33 Merge branch 'PyBuffer_Release-pybuffer'
* PyBuffer_Release-pybuffer:
  Add tests.
  Fix the error handling for the PyObject_GetBuffer() calls in pybuffer.i
2020-10-07 22:37:17 +01:00
William S Fulton
fe676f840a Merge branch 'director-return-const-pointer'
* director-return-const-pointer:
  Put test in alphabetical order
  Perform proper spacing in director method declarations
2020-10-07 22:26:25 +01:00
William S Fulton
339377410b Put test in alphabetical order 2020-10-07 22:21:37 +01:00
William S Fulton
61ea3c05de Add missing virtual destructor to testcase 2020-09-28 09:57:51 +01:00
William S Fulton
c1b004f4fa Add access modifier support for interface feature
Add ability to change the modifiers for the C# and Java
interface generated when using the %interface macros.

For C# use the 'csinterfacemodifiers' typemap.
For Java use the 'javainterfacemodifiers' typemap.

For example:

  %typemap(csinterfacemodifiers) X "internal interface"

Closes #1874
2020-09-25 18:54:25 +01:00
William S Fulton
71d4822860 Add Ruby test for wchar_t members in li_std_string testcase 2020-09-24 22:36:32 +01:00
Gareth Francis
33765e5025 Extend C# wchar_t member test to pass unicode strings 2020-09-12 17:19:15 +01:00
Gareth Francis
6db3ab0d05 Add test for wchar_t members to li_std_string.i 2020-09-12 17:04:28 +01:00
Karl Wette
251ab662bf Octave: error() must be called with an argument 2020-08-27 17:19:13 +10:00
William S Fulton
b1c0145fd3 Python 3.2 syntax error fixes in tests 2020-08-15 23:51:40 +01:00
William S Fulton
c5e078c437 Revert 2to3 modification
Use sys.maxint still for Python 2
2020-08-15 23:50:31 +01:00
William S Fulton
baec830f75 Merge branch 'remove-dependency-on-2to3'
* remove-dependency-on-2to3:
  Remove need for Python 2to3
  Modify examples to be both Python 2 and 3 compatible
  Remove python3 specific runme3.py test files
  Convert python tests using 2to3
  Convert python test scripts to be Python 2 and 3 compatible
  Convert swigobject python test to be python 2 and 3 compatible
  Convert two tests to work with both Python 2 and 3
  Improve director_exception Python test
  Remove further print statements from Python tests
  Improve Python testing catching exceptions
  Improve contract Python testcase testing
  Remove print statements from Python tests
2020-08-15 19:03:38 +01:00
William S Fulton
cc94e5168f Add missing test to python test-suite 2020-08-15 19:02:52 +01:00
William S Fulton
ec2b47ef2a Remove need for Python 2to3
All Python examples and tests have been written to be both Python 2 and Python 3
compatible, removing the need for 2to3 to run the examples or test-suite.

The 2to3 executable is not always available and even when available does not
always work, e.g. with pyenv. An alternative would be to use the lib2to3 Python
module instead, but this isn't available in some older versions of Python 3.

I had this problem on Ubuntu Bionic on Travis:

  checking Examples/python/callback
  pyenv: 2to3-3.8: command not found
  The `2to3-3.8' command exists in these Python versions:
    3.8
    3.8.1

Reference issues:
  https://github.com/pypa/virtualenv/issues/1399
  https://travis-ci.community/t/2to3-command-not-found-in-venv-in-bionic/4495
2020-08-15 18:04:58 +01:00
William S Fulton
89bee6a7fa Modify examples to be both Python 2 and 3 compatible
For removing dependency on 2to3
2020-08-15 16:46:01 +01:00
William S Fulton
bc7a067587 Remove Examples/contract
This set of examples was never tested/documented
There is an equivalent testcase in Examples/test-suite/contract.i
2020-08-15 12:26:21 +01:00
William S Fulton
2af35cb4ff Remove python3 specific runme3.py test files
This file can be run using Python 2, the test is just ignored
2020-08-15 12:20:23 +01:00
William S Fulton
d4ffa46f41 Convert python tests using 2to3
These tests were converted using 2to3 and should be valid using
Python 2.7 and Python 3+.
2020-08-15 00:16:04 +01:00
William S Fulton
66df0bd224 Convert python test scripts to be Python 2 and 3 compatible
Unicode testing
2020-08-15 00:09:31 +01:00
William S Fulton
36bb54f01d Convert swigobject python test to be python 2 and 3 compatible 2020-08-14 23:27:35 +01:00
William S Fulton
982b08dced Convert two tests to work with both Python 2 and 3
Now these two tests work without having to use 2to3
2020-08-13 23:34:28 +01:00
William S Fulton
d820045336 Improve director_exception Python test
Add code to handle missed exceptons.
Remove print statement.
2020-08-13 22:00:01 +01:00
William S Fulton
9169555628 Remove further print statements from Python tests
Use exceptions instead of printing to stdout.
Part of an effort to convert Python tests to python 3 syntax.
2020-08-13 21:47:20 +01:00
William S Fulton
64d3617b3c Improve Python testing catching exceptions
Catch expected exceptions only
2020-08-13 21:40:11 +01:00
William S Fulton
7c34d3828f Improve contract Python testcase testing
Catch expected exceptions only - fix bug in test
2020-08-13 21:31:56 +01:00
William S Fulton
365d4961d4 Remove print statements from Python tests
Use exceptions instead of printing to stdout.
Part of an effort to convert Python tests to python 3 syntax.
2020-08-13 21:22:47 +01:00
William S Fulton
f383095851 Alphabetise testing of examples 2020-08-13 20:07:10 +01:00
William S Fulton
bfddc50a6a Add C# support for void *VOID_INT_PTR member variables
Issue reported by Carlos Frederico Biscaya on swig-user mailing list.
2020-08-13 16:06:48 +01:00
William S Fulton
a38f30a194 Add basic std::pair Python testing
Based on Ruby's li_std_pair_runme.rb
2020-08-13 16:06:48 +01:00
Thomas Reitmayr
c259702314 Perform proper spacing in director method declarations
If a director method returns a const pointer, eg. 'int *const', then in its
method declaration a space has to be inserted between 'const' and the
method name.
This fixes swig#1810.
2020-06-20 12:14:42 +02:00
Zackery Spytz
c4c8751892 Add tests. 2020-06-15 01:33:59 -06:00
William S Fulton
ee7eb6b58a Merge branch 'directors-comparison-operators'
* directors-comparison-operators:
  Use %rename
  Fix wrapping of virtual comparison operators with directors
2020-06-14 22:23:57 +01:00
Zackery Spytz
b1b13d7d0a Use %rename 2020-06-07 13:56:07 -06:00
William S Fulton
8041bfdf09 Ruby testcase fix
Reportedly failing. Failure can be replicated with 2.5.1 by increasing
number of loops.
Workaround is to disable GC.

Closes #1646
2020-06-07 17:59:21 +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
Zackery Spytz
4e57c5536d Fix wrapping of virtual comparison operators with directors
Closes #1642.
2020-06-05 10:25:20 -06:00
William S Fulton
85f2378b84 Merge branch 'r-script-fixes'
* r-script-fixes:
  Fix further missing semicolons in R code.
  fixed some missing semicolons. Each one caused a compile error in generated code
2020-06-02 18:11:12 +01:00
William S Fulton
6542d848dc Fix further missing semicolons in R code.
Fixes errors in R code when using -small as this option causes lines to be joined.
2020-06-02 10:16:18 +01:00
Karl Wette
d11e29615d Octave: use pre-compiled headers to speed up test suite, if supported 2020-05-31 22:11:51 +10:00
William S Fulton
f68d0c6da3
Merge pull request #1788 from mcfarljm/Issue-1757
Fix for missing space after \endlink in doxygen
2020-05-28 22:25:53 +01:00
Vadim Zeitlin
6c5d00bd0d Ignore ambiguous variable names error from pycodestyle 2.6
This error is given for any use of variable called "l" (and also "I" and
"O", but we don't seem to have any of those) and it doesn't seem to be
worth changing this variable name in the tests code, as it's really not
that meaningful there anyhow, so just disable the warning to let the CI
builds, which now use pycodestyle 2.6, instead of 2.5 which didn't have
this error and which is still the latest available in Debian Sid, pass.
2020-05-22 16:17:45 +02: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
Ryan Nevell
18608816db Clean up test cases 2020-02-17 09:16:42 -08:00
Ryan Nevell
33c59614fc Fix unwrapping of LUA lightuserdata type. Add test case. 2020-02-17 09:16:24 -08:00
William S Fulton
c914b1eb78 Merge branch 'abstract-conversion-operators'
* abstract-conversion-operators:
  Add test cases for abstract user-defined conversion operators
  Recognize C++ conversion operators with trailing '= 0' as abstract
2020-02-14 07:12:26 +00:00
William S Fulton
fc2f0204ba Port Ruby test of vector<shared_ptr<>> to Python
This test code tests the upcast code:
  swig_assert_equal_simple(-1, base_num2([Derived(7)]))
Although there is no explicit memory leak fix test, it does at least run the code.

Handling of None needs fixing in Python (it is working in Ruby)
Note that the Ruby implementation has a partial template specialization
for shared_ptr, whereas the Python implementation is in the generic
code!

Issue #1512
2020-02-13 19:21:30 +00:00
Thomas REITMAYR
eb2be58a12 Add test cases for abstract user-defined conversion operators 2020-02-13 20:16:44 +01:00
William S Fulton
a01e8474f6 Fixing setting this in Python when using __slots__
Don't attempt to use the class's __dict__ for setting 'this' when
a user has extended a class with:
    __slots__ = ['this'].
Was segfaulting. Now we fall back to a simple PyObject_SetAttr if the
usual approach to setting 'this' in __dict__ does not work.

Closes #1673 Closes #1674
2020-02-06 07:08:16 +00:00