67 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto b80e0ef742 Move Kernel#send to mruby-metaprog gem.
But `BasicObject#__send__` is still available from the core.
2018-09-01 11:20:30 +09:00
Yukihiro "Matz" Matsumoto e471d37ca5 Separate meta-programming features to mruby-metaprog gem.
We assume meta-programming is less used in embedded environments.
We have moved following methods:

 * Kernel module
   global_variables, local_variables, singleton_class,
   instance_variables, instance_variables_defined?, instance_variable_get,
   instance_variable_set, methods, private_methods, public_methods,
   protected_methods, singleton_methods, define_singleton_methods

 * Module class
   class_variables, class_variables_defined?, class_variable_get,
   class_variable_set, remove_class_variable, included_modules,
   instance_methods, remove_method, method_removed, constants

 * Module class methods
   constants, nesting

Note:
Following meta-programming methods are kept in the core:

 * Module class
   alias_method, undef_method, ancestors, const_defined?, const_get,
   const_set, remove_const, method_defined?, define_method

 * Toplevel object
   define_method

`mruby-metaprog` gem is linked by default (specified in default.gembox).
When it is removed, it will save 40KB (stripped:8KB) on x86-64
environment last time I measured.
2018-08-30 22:30:36 +09:00
Kazuhiro Sera b03f1f78e3 Fix misspelling words in comments 2018-08-11 00:28:32 +09:00
Christopher Aue 4b0b8f7e1a Refactored #assert_raise and #assert_nothing_raised 2017-08-29 23:25:53 +02:00
Yukihiro "Matz" Matsumoto 9e10afe1d0 Implements `Module::nesting' (15.2.2.3.2); ref #600, #3200 2017-08-01 15:37:21 +09:00
Yukihiro "Matz" Matsumoto b290e98f3b Merge pull request #3757 from christopheraue/module_const_get_class_path
Extended Module#const_get to support class paths
2017-07-29 07:05:37 +09:00
Christopher Aue f937af5745 Extended Module#const_get to support class paths 2017-07-28 23:19:49 +02:00
Christopher Aue b499ad6749 Fixed return value of Module#include and #prepend 2017-07-28 17:38:40 +02:00
Christopher Aue 468cc34c93 Fixed Module#to_s and #name for #const_set modules 2017-07-18 22:55:37 +02:00
Kouichi Nakanishi 507e00e86f Modify to get constant of parent module in singleton class; fix #3568 2017-03-31 13:43:20 +09:00
ksss efe4f30b39 Module#define_method supports proc argument 2016-10-12 22:19:54 +09:00
Blaž Hrastnik 78462c9181 Clean up tests 2015-07-13 23:46:41 +02:00
Blaž Hrastnik 8c4da7accd assert() cannot be nested 2015-07-13 23:38:37 +02:00
Blaž Hrastnik 8c13e2b7c6 Set origin when doing kind_of? comparisons 2015-07-13 23:35:30 +02:00
Blaž Hrastnik b0fb9ccfd8 Enable test_prepend_module_ancestors because it seems to pass. 2015-07-13 23:25:01 +02:00
Corey Powell 11cb41770d Space out test_prepend_super_in_alias assert
Also tried to fix it, however the problem lies with how aliased methods
are done and their internal structure.

mruby simply aliases methods by grabbing the RProc and giving it a new name,
super then determines the original method to call by using the name

so a method called m, aliased as m2, will call the m2 super method instead of m
2015-07-13 10:45:57 -05:00
Blaž Hrastnik 11dad71578 Enable visibility prepend tests again 2015-07-13 14:04:43 +02:00
Corey Powell 47264bf289 Ported all MRI prepend tests
And of course, some of them fail miserably
2015-07-13 14:04:42 +02:00
Corey Powell 319553f0ef Removed some debug prints from the test 2015-07-13 14:04:42 +02:00
Corey Powell 99aff17075 Ported a bit more of the MRI Module#prepend tests over
Currently kind_of fails miserably, still looking for the reason
2015-07-13 14:04:42 +02:00
Blaž Hrastnik d046814d8b Rename classes because of conflicts 2015-07-13 14:04:42 +02:00
Blaž Hrastnik f962890a92 Implement Module#prepend. 2015-07-13 14:04:42 +02:00
cremno 59ea323976 check if outer is a class or module
For modules this check didn't exist yet. Also call #inspect.
2015-05-29 14:58:53 +02:00
Yukihiro "Matz" Matsumoto 69ba4f0ed5 instance_methods etc should not include undef'ed method names; based on a patch from @cremno; fix #2613 2014-10-20 11:11:26 +09:00
Tatsuhiko Kubo 2b283393c6 Remove empty lines. 2014-08-20 12:07:36 +09:00
dreamedge 0b8a0f4bb4 add Module#module_function 2014-07-18 09:50:54 +09:00
take_cheeze ec5b055694 Move direct superclass checking to test/t/superclass.rb. 2014-06-15 15:02:21 +09:00
ksss 0bd8e48773 Module#initialize set created object
for block argument
2014-05-21 23:09:19 +09:00
ksss ffbf90bdc8 Implement Module#initialize (15.2.2.4.31) 2014-05-19 19:28:42 +09:00
ksss 464bbbddc7 instance method name use "#" instead of "." for assert 2014-05-18 10:54:23 +09:00
Nobuyoshi Nakada ab67c57f65 remove trailing spaces 2014-04-30 09:50:14 +09:00
h2so5 25045345c9 clone Class/Module rightly 2014-01-25 07:47:15 +09:00
Carson McDonald 5ab9979ba4 Change :vattr= to :cattr= in respond_to? test 2013-12-24 12:12:50 -05:00
Yukihiro "Matz" Matsumoto fa4ae7dd4d modify test case to check #1606 2013-12-09 11:44:02 +09:00
Carson McDonald 3385a33e9e Add two tests for issue #1467 2013-08-13 11:39:30 -04:00
Jun Hiroe dddb5faff0 I fix order of actual and expect test value in module.rb. 2013-08-02 22:04:23 +09:00
Ryan Scott ab787ab968 Cleaned up some of the Module#attr tests 2013-07-21 18:43:00 +10:00
Ryan Scott fe5324bd17 Wrote tests around attr, attr_reader, attr_writer, attr_accessor 2013-07-19 22:39:54 +10:00
Daniel Bovensiepen f092c8df73 Improve Module Tests 2013-06-15 01:49:48 +08:00
Yukihiro "Matz" Matsumoto a092e41020 the receiver should be included in ancestors even when it's a singleton class 2013-04-30 00:51:31 +09:00
skandhas 8d778d9860 fix Module#ancestors and update test 2013-04-25 11:17:34 +08:00
Carson McDonald 35f42c264e Remove unused variable 2013-04-21 08:22:40 -04:00
Yukihiro "Matz" Matsumoto 58b877c4a7 fix test to check class variables in superclasses 2013-04-20 22:59:35 +09:00
Masaki Muranaka d1b131e2b0 Add some tests. 2013-04-06 18:22:42 +09:00
Masaki Muranaka e129a4c8ef Add test cases. 2013-04-02 11:43:30 +09:00
Daniel Bovensiepen 0aa35895f9 Add Module#remove_const test 2013-02-16 18:15:25 +00:00
skandhas c4995884e6 add test for Module#method_defined? 2013-01-04 15:41:10 +08:00
skandhas 9219c856a8 add test for Module#remove_method 2012-12-29 14:44:28 +08:00
skandhas 3ffe8fe105 add test for Module#remove_class_variable 2012-12-25 12:13:31 +08:00
skandhas bdd0cc0111 add test for Module#class_variable_defined? 2012-12-23 15:52:27 +08:00