Commit graph

259 commits

Author SHA1 Message Date
William S Fulton
a9a7b03ba6 Split testcases li_std_wstring.i and li_std_wstring_inherit.i
Not many languages have support for std_wstring.i, so disable testing
for these languages until added.
2019-07-22 19:05:21 +01:00
William S Fulton
5131096b80 li_std_wstring test rename to li_std_wstring_inherit
This testcase was only run in Ruby and Python and implements an
obscure feature where a C++ class inherits from a std::wstring.

The li_std_wstring test is left in place to be modified in next commit
for more regular wstring testing across all languages.
2019-07-18 19:49:50 +01:00
Takashi Tamura
ff9e9f9f98 [ruby] check whether object is of RTypedData using RTYPEDDATA_P. 2019-02-22 19:55:54 +00:00
William S Fulton
1f44997343 rename std::array testcase 2019-02-13 22:46:20 +00:00
William S Fulton
d14c97408d Fix overloading for non-pointers and NULL - Ruby 2018-12-29 14:15:51 +00:00
luz.paz
ed28e7cbe2 Misc. typo and whitespace fixes
Found via `codespell -q 3 -L "uint,bae,objext,cmo,goin,struc,ois,upto"`
whitespaces were unintentionally fixed due to my editors settings.

Rebased patch #1327
2018-09-19 20:29:14 +01:00
Joel Anderson
a1cea4f483 Fix ruby %alias directive for native c functions
Using the %alias directive on native C functions causes swig to segfault due to
a dereference of klass (which is NULL for native C functions) in the
defineAliases function of the Ruby module. This commit adds support for an alias
of native C functions for both separate module as well as global functions, as
well as three test cases for the %alias directive of the Ruby module.

Fixes:
mod.i
%module ruby_alias
%alias get_my_name "nickname,fullname";
%inline %{
const char *get_my_name(){
  return "Chester Tester";
}
%}
$ swig -ruby mod.i
Segmentation fault

Signed-off-by: Joel Anderson <joelanderson333@gmail.com>
2018-03-22 08:05:01 -04:00
William S Fulton
6470fe8c36 Director shared_ptr typemaps for scripting languages
Modify the Python and Ruby director shared_ptr typemaps to be language neutral.
Port the director modifications to other scripting languages that
have shared_ptr support - Octave, R and Scilab. Scilab shared_ptr
support is not fully working and needs work though.
2017-10-13 07:34:38 +01:00
Stephen Sinclair
bda750ee15 Add directorin typemap for Python and Ruby shared_ptr. 2017-09-27 11:22:30 -03:00
William S Fulton
ed4b84f4d3 Fix overloading of shared_ptr method overloading
Add 'equivalent' attribute to typecheck typemap.
Closes #1098.
2017-09-23 15:19:34 +01:00
William S Fulton
e9e9531dc3 Merge branch 'tamuratak-fix_ruby_wstring'
* tamuratak-fix_ruby_wstring:
  [ruby] use %fragment to clarify the dependency of code.
  [ruby] should initialize static variables inside %init{}, in which it will not be        excuted concurrently by multiple threads.
  [ruby] * use static variable to avoid creating stirngs every time.        * fix possible overflow.
  [ruby] add std::wstring tests for string including a null terminator.
  [ruby] * rewrite SWIG_AsWCharPtrAndSize and SWIG_FromWCharPtrAndSize        * use UTF-32LE and UTF-16LE to avoid BOM        * add tests
  [ruby] use WCHAR_MAX to determine the encoding of std::wstring.
  [ruby] add a few tests for std::wstring
  [ruby] fix support for std::wstring.
2017-06-20 20:13:01 +01:00
William S Fulton
241460eddc director_smartptr runtime tests enhancement
Add same changes from previous commit to additional languages
2017-05-23 21:36:24 +01:00
William S Fulton
db11e82896 Makefile cosmetics 2017-04-24 20:45:01 +01:00
William S Fulton
32855cfb69 Merge branch 'tamuratak-fix_ruby_unordered_set'
* tamuratak-fix_ruby_unordered_set:
  [ruby] add simple tests for std unordered containers.
  [ruby] clarify dependency of fragments for unordered_set containers.

 Conflicts:
	Examples/test-suite/ruby/Makefile.in
2017-04-24 20:44:12 +01:00
William S Fulton
ee44f9ba67 Merge branch 'tamuratak-fix_ruby_null_shared_ptr'
* tamuratak-fix_ruby_null_shared_ptr:
  [ruby] add a test.
  [ruby] use std::vector::back() method.
  [ruby] enable a test for null shared_ptr in containers.
  [ruby] add a test for null shared_ptr in containers.
  [ruby] treat null shared_ptr in std containers properly.

Conflicts:
	Examples/test-suite/ruby/Makefile.in
2017-04-24 19:50:59 +01:00
Takashi Tamura
70740c51d0 [ruby] add simple tests for std unordered containers. 2017-04-22 16:36:09 +09:00
William S Fulton
093cf8d60f Rename shared_ptr testcase 2017-04-21 19:28:08 +01:00
Takashi Tamura
0020fc97b0 [ruby] add %typemap(directorin) for shared_ptr. 2017-04-20 19:20:55 +09:00
Takashi Tamura
0f94b936e8 [ruby] enable a test, cpp11_shared_ptr_director. 2017-04-20 19:20:54 +09:00
Takashi Tamura
17b4e0c66e [ruby] add %typemap(directorin) and %typemap(directorout) for shared_ptr. 2017-04-20 19:20:11 +09:00
Takashi Tamura
b3c2b1c51c [ruby] add %typemap(directorout) for shared_ptr. 2017-04-20 19:20:11 +09:00
Takashi Tamura
1c968b3695 add a test for shared_ptr with director 2017-04-20 19:20:11 +09:00
Takashi Tamura
34ba3b9ed9 [ruby] add a test. 2017-04-20 18:56:02 +09:00
Takashi Tamura
042d8289fd [ruby] enable a test for null shared_ptr in containers. 2017-04-20 18:56:02 +09:00
Takashi Tamura
0c3298073b [ruby] add a test for null shared_ptr in containers. 2017-04-20 18:56:02 +09:00
William S Fulton
6398614c92 Update ruby tests for change in swig_assert_equal_simple name 2017-04-20 07:57:48 +01:00
William S Fulton
c9d094e034 Merge branch 'tamuratak-shared_ptr_derived_2'
* tamuratak-shared_ptr_derived_2:
  Correct comment about const removal for shared_ptr
  Correct ordering of declarations in testcase
  Ruby shared_ptr on error code improvement in traits_as::as
  Add support for pointers to shared_ptr and null shared_ptr in Ruby containers
  Add shared_ptr non-overloaded upcast tests
  use forward declaration to treat the dependency of fragments
  [ruby] must not do a null check for VALUE.
  [ruby] add tests for shared_ptr of const Type.
  [ruby] For swig::from, use template specialization to convert shared_ptr<const T> to shared_ptr<T>.
  [ruby] edit comments [skip ci]
  [ruby] move template specialization to std_shared_ptr.i.
  [ruby] add tests for upcasting std::shared_ptr within std containers.
  [ruby] use template specialization for swig::asptr,asval functions on std:shared_ptr.
2017-04-20 07:50:20 +01:00
William S Fulton
83a389d3fb Add support for pointers to shared_ptr and null shared_ptr in Ruby containers
Upcasting of pointers to shared_ptr would need some more fundamental
changes, but not done yet ... pointers to shared_ptr are not common.
2017-04-13 06:59:56 +01:00
William S Fulton
bd233408e8 Add shared_ptr non-overloaded upcast tests 2017-04-07 07:34:58 +01:00
William S Fulton
ceea1d9905 Merge branch 'tamuratak-ruby_simple_assertion'
* tamuratak-ruby_simple_assertion:
  Rename new Ruby assert functions used in test-suite
  [ruby] add simple assertions.
2017-03-31 07:32:28 +01:00
William S Fulton
d56c8ef9ff Rename new Ruby assert functions used in test-suite 2017-03-31 07:32:04 +01:00
Takashi Tamura
377d439964 Merge remote-tracking branch 'origin/shared_ptr_const_conv' into shared_ptr_derived_2 2017-03-29 18:16:01 +09:00
William S Fulton
382b3f0f8c Merge branch 'tamuratak-fix_typo_ruby_unordered_map'
* tamuratak-fix_typo_ruby_unordered_map:
  [ruby] add a test to make sure that std::multiset is including Enumerable.
  [ruyb] enable std::list test for Ruby.
  [ruby] make std::list include Enumerable.
  [ruby] make std::multiset and std::unordered_multiset include Enumerable. tests added.
  [ruby] make std::unordered_map include Enumerable.
2017-03-29 08:56:25 +01:00
Takashi Tamura
d0af6fd97d [ruby] must not do null check for VALUE obj, which can be 0x0 == Qfalse, a valid Ruby object. 2017-03-06 15:13:05 +09:00
Takashi Tamura
b91e03d39a [ruby] add tests for shared_ptr of const Type. 2017-03-03 16:58:51 +09:00
Takashi Tamura
f96c2ad73d [ruby] For swig::from, use template specialization to convert shared_ptr<const T> to shared_ptr<T>. 2017-03-03 12:50:23 +09:00
Takashi Tamura
a84ea749b3 [ruby] add tests for upcasting std::shared_ptr within std containers. 2017-03-01 21:32:03 +09:00
Takashi Tamura
a02b7810bc [ruby] add a test to make sure that std::multiset is including Enumerable. 2017-02-26 22:12:39 +09:00
Takashi Tamura
b525848063 [ruyb] enable std::list test for Ruby. 2017-02-26 07:17:33 +09:00
Takashi Tamura
c88b9e8777 [ruby] make std::list include Enumerable. 2017-02-25 16:08:21 +09:00
Takashi Tamura
b8d383cb4a [ruby] add simple assertions. 2017-02-25 15:44:49 +09:00
Takashi Tamura
9f43082786 [ruby] make std::multiset and std::unordered_multiset include Enumerable. tests added. 2017-02-24 16:59:17 +09:00
Takashi Tamura
89695255e6 [ruby] add std::wstring tests for string including a null terminator. 2017-02-20 17:49:17 +09:00
Takashi Tamura
4009da3588 [ruby] * rewrite SWIG_AsWCharPtrAndSize and SWIG_FromWCharPtrAndSize
* use UTF-32LE and UTF-16LE to avoid BOM
       * add tests
2017-02-20 17:00:52 +09:00
Takashi Tamura
bfe7204576 [ruby] add a few tests for std::wstring 2017-02-18 17:54:03 +09:00
William S Fulton
16b583ec25 Move cpp11_hash_tables test to Ruby makefile until other languages work 2017-02-10 19:38:00 +00:00
Takashi Tamura
ec9b380c0c [ruby] add tests for unordered containers. 2017-01-29 11:18:53 +09:00
William S Fulton
f9ba371ee4 Remove li_boost_array testcase
Too many problems, this attempt to use std::array typemaps for boost::array
isn't really working. Latest problem is clang compile failures on OSX.
2016-10-15 17:58:17 +01:00
William S Fulton
763827c2e1 Ruby opaque pointer handling regression fix
This bug was introduced in swig-3.0.8 in #146252 adding shared_ptr
support. An ObjectPreviouslyDeleted error was incorrectly thrown
when the pointer was used as a parameter after being set to zero
via a call to 'DATA_PTR(self) = 0'.

It isn't clear to me which approach is better in this corner case,
so I've gone for backwards compatibility and restored the old behaviour.

Closes #602
2016-05-24 19:09:17 +01:00
William S Fulton
bbc06c5254 Don't run some tests twice 2016-02-21 21:36:43 +00:00