Commit graph

4,144 commits

Author SHA1 Message Date
William S Fulton
6840996dba Fix wrapping D constants using %dmanifestconst 2016-03-12 11:26:17 +00:00
William S Fulton
7339de974d Fix static const char member variables wrappers with %javaconst(1).
This fixes the case when an integer is used as the initializer, such as:

  struct W { static const char w = 100; };

The "valuetype" attribute has been added to the "cdecl" Node which enables
us to distinguish the declared type from the type of the initializer.
2016-01-27 09:01:00 +00:00
William S Fulton
95eb6649ea Expand char testing in enums and %constant 2016-01-27 08:47:37 +00:00
William S Fulton
62c34fc9d9 Add tests for enum values and static const member variables chars containing escape sequences 2016-01-26 20:16:47 +00:00
Ben Webb
2a5bbb6018 Qualify use of "__builtin__.Exception" class.
It is possible that the module we're wrapping defines an Exception
class. This will confuse code that uses an unqualified "Exception"
class (e.g. "try: ... except Exception") since it now won't match
the Python builtin Exception. Fix this by explicitly using
the class from the __builtin__ module ("builtins" in Python 3).
2016-01-11 21:43:10 -08:00
William S Fulton
575b4e58e5 Merge branch 'ahnolds-Win64_ptrdiff_t'
* ahnolds-Win64_ptrdiff_t:
  Adding required define at beginning
  Unit tests for ptrdiff_t/size_t max/min in Python
  Python2 build on x64 should no longer fail
  Don't use long long if it isn't available
  Add support for ptrdiff_t and size_t == long long
2016-01-10 17:30:57 +00:00
Alec Cooper
1875ff9002 Adding required define at beginning 2016-01-09 10:41:24 -05:00
İsmail Dönmez
b1f45053bb Fix test failure on PPC{64} where the char is unsigned by default 2016-01-08 12:00:03 +02:00
Alec Cooper
fc8e76544c Unit tests for ptrdiff_t/size_t max/min in Python 2016-01-06 17:45:21 -05:00
Alec Cooper
2f8a7b822d Adding unit tests for Python primitive type conversions
Adding unit tests for operator overloading to determine which overload was chosen
  Allow TypeError when testing overloads since it is generated instead
  of NotImplementedError when swig is run with -O or -fastdispatch
2015-12-23 19:04:27 -05:00
William S Fulton
adc773455d Merge branch 'missing-initializers'
* missing-initializers:
  Tcl fix when using -Wmissing-field-initializers warnings
  Php fix for -Wmissing-field-initializers warning
  Fixes for Octave and missing -Wmissing-field-initializers in swig_octave_member
  Fixes for Ruby and using -Wmissing-field-initializers
  R test case warning fixes
  Use -Wmissing-field-initializers warning testing all languages on Travis
2015-12-19 16:34:38 +00:00
William S Fulton
04539a930d R test case warning fixes 2015-12-19 16:21:22 +00:00
William S Fulton
01611702ec Python 2 Unicode strings can be used as inputs to char * or std::string types
Requires SWIG_PYTHON_2_UNICODE to be defined when compiling generated code.
2015-12-19 03:55:26 +00:00
William S Fulton
b15ad9349e Merge branch 'coleb-python35_dtor_exception_fix'
* coleb-python35_dtor_exception_fix:
  Add test case for Python 3.5 assertion with a pending StopIteration
  Amend python_destructor_exception runtime test
  Call PyErr_WriteUnraisable if a destructor sets a Python exception (-builtin)
  Extended zjturner's changes to encompass all function dispatch and use PyErr_WriteUnraisable to handle exceptions during __del__.
  Python - Save and restore exception state before calling destroy.
2015-12-16 12:58:01 +00:00
William S Fulton
26f52c53f4 Add test case for Python 3.5 assertion with a pending StopIteration
Testcase for issue #559 #560 #573
2015-12-16 12:57:06 +00:00
William S Fulton
dd73d81933 Amend python_destructor_exception runtime test
Suppress the message that PyErr_WriteUnraisable writes to stderr,
but check that it is called by checking some of the expected message contents.
The output varies slightly for different versions of Python and -builtin
2015-12-16 12:57:05 +00:00
Brian Cole
a863e98874 Extended zjturner's changes to encompass all function dispatch and use PyErr_WriteUnraisable to handle exceptions during __del__.
Also added test cases for the unnamed temporary destruction that is throwing assertions in Python 3.5.
2015-12-15 08:39:55 -07:00
William S Fulton
6b4e57245d Fix STL wrappers to not generate <: digraphs.
For example std::vector<::X::Y> was sometimes generated, now
corrected to std::vector< ::X::Y >.
2015-12-12 14:05:46 +00:00
William S Fulton
3bfffab9f9 Fix boost::array test for Visual Studio
Visual Studio doesn't set __cplusplus correctly when supporting c++11
2015-12-05 09:00:04 +00:00
William S Fulton
80a8a7f0d8 boost::array test fix when using C++11 2015-11-28 18:49:22 +00:00
William S Fulton
93eb7eae0b Limited Python/Ruby support for boost::array
Hack to use the std::array support for boost::array.
Is limited as it currently exposes some 'using' bugs in SWIG.
For example, the type system fails to see that pointers to std::array
and pointers to boost::array are the same.

This approach saves having to maintain separate boost::array support.
The 'using' bug ought to be fixed, otherwise separate boost_array.i
files could be easily made from the std_array.i files.
2015-11-27 19:30:22 +00:00
William S Fulton
bb2523a003 Ruby STL container setting slices fixes
Setting an STL container wrapper slice better matches the way Ruby
arrays work. The behaviour is now the same as Ruby arrays. The only
exception is the default value used when expanding a container
cannot be nil as this is not a valid type/value for C++ container
elements.
2015-11-25 10:13:30 +00:00
William S Fulton
cd33aba427 Ruby STL container ranges and slices fixes.
Access via ranges and slices now behave identically to Ruby arrays.
The fixes are mostly for out of range indices and lengths.
- Zero length slice requests return an empty container instead of nil.
- Slices which request a length greater than the size of the container
  no longer chop off the last element.
- Ranges which used to return nil now return an empty array when the
  the start element is a valid index.
2015-11-25 09:19:13 +00:00
William S Fulton
97b129de6c Add out of bounds Ruby std::vector and std::array access testing
Also fix swig_assert_equal to work with nil as an expected input
2015-11-25 09:19:13 +00:00
William S Fulton
fe09f05beb Ruby STL container negative indexing support improved
Using negative indexes to set values works the same as Ruby arrays, eg

%template(IntVector) std::vector<int>;

iv = IntVector.new([1,2,3,4])
iv[-4] = 9 # => [1,2,3,9]
iv[-5] = 9 # => IndexError
2015-11-25 09:19:13 +00:00
William S Fulton
19c24a4f60 Ruby container testing enhancement - setting slices 2015-11-25 09:19:13 +00:00
William S Fulton
b8feb85f0e Add Ruby std_array.i - std::array wrappers 2015-11-25 09:19:05 +00:00
William S Fulton
55bbf68512 Add std::array container wrappers for Python
These work much like any of the other STL containers except Python slicing
is somewhat limited because the array is a fixed size. Only slices of
the full size are supported.
2015-11-17 07:27:48 +00:00
William S Fulton
593c452c37 Fix overloaded templates and default arguments
The defaultargs attribute was not being correctly set for functions with
default arguments when instantiated with %template.

Closes #529
2015-10-11 17:30:34 +01:00
William S Fulton
3e9854d308 Fix incorrect director_classic_runme.py test
Python 3.5 and -builtin threw an error as the incorrect base was being
initialized.
2015-10-10 01:26:29 +01:00
William S Fulton
9104adc60a Test case fix 2015-10-03 12:10:14 +01:00
William S Fulton
fc2205e64d %shared_ptr support improvements for classes in an inheritance chain
Fix %shared_ptr support for private and protected inheritance.
- Remove unnecessary Warning 520: Derived class 'Derived' of 'Base'
  is not similarly marked as a smart pointer
- Do not generate code that attempts to cast up the inheritance chain in the
  type system runtime in such cases as it doesn't compile and can't be used.
Remove unnecessary warning 520 for %shared_ptr when the base class is ignored.
2015-10-01 22:36:01 +01:00
William S Fulton
e12277a469 Ruby shared_ptr fixes for use with minherit 2015-10-01 22:36:01 +01:00
William S Fulton
04fd4a9c68 Director smartptr testing - add Python test 2015-10-01 22:36:00 +01:00
Vladimir Kalinin
ec93b01a09 Issue #508: Classprefix is not restored after nested structures processing. Also, Classprefix is incorrectly checked in some places. 2015-10-01 15:06:42 +03:00
William S Fulton
350eff3687 Director smartptr testing
- Enhance Java and C# test
- Add Ruby test
2015-09-30 07:53:19 +01:00
William S Fulton
f266a588e0 Cosmetic comment fix in testcase 2015-09-30 07:06:40 +01:00
William S Fulton
a7cc3267bc Add more Ruby shared_ptr runtime tests 2015-09-26 00:12:57 +01:00
William S Fulton
004ae163e5 Add RUBYFLAGS for Ruby testing
make check RUBYFLAGS=-v can be useful
2015-09-25 23:15:25 +01:00
William S Fulton
4c2da8184b li_boost_shared_ptr tests cleanup
Remove some cruft
2015-09-25 23:14:34 +01:00
William S Fulton
f5a6e94466 Ruby shared_ptr testing enhancements
li_boost_shared_ptr_runme.rb: add garbage collection to properly check
expected reference counts
2015-09-25 22:58:01 +01:00
William S Fulton
2506ccd4f4 Add shared_ptr Ruby runtime test
Reference count tests not quite complete yet - need to be sure of
control of the garbage collector to test this reliably.
2015-09-25 22:58:01 +01:00
William S Fulton
155233bea6 Turn on missing shared_ptr tests for Octave 2015-09-25 22:58:00 +01:00
William S Fulton
c089908f07 Turn on Ruby shared_ptr testing 2015-09-25 22:58:00 +01:00
William S Fulton
89f13b03da Correct to Unix CR/LF 2015-09-05 16:18:03 +01:00
William S Fulton
b5873218b6 Ruby mark_function example and docs fixes
Relates to Ruby trackings hash bug #225
2015-09-05 15:30:50 +01:00
Olly Betts
e903854ded valgrind --trace-children=yes no longer required
We no longer use the preinst-swig wrapper script in the testsuite.
2015-09-04 14:29:21 +12:00
Olly Betts
8ab622c6d0 [Python] Fix docstrings for %callback functions
Reinstates autodoc for callback function testcase from #467, actually
tests the resulting docstring in the _runme.py and fixes SWIG/Python
so the expected result is obtained.
2015-09-04 13:04:37 +12:00
Olly Betts
aa0e781034 Suppress pep8 E731 (lambda assignment)
This is a new warning in pep8 1.6.0 which breaks our testsuite.
2015-09-04 12:50:52 +12:00
Olly Betts
9e69a2c198 Use name of PHP resource not wrapped C++ type
Since callback::foo_T<int> isn't a PHP resource, that error message doesn't
really make sense as it was.  As discussed in #467.
2015-09-04 12:14:21 +12:00