Yukihiro "Matz" Matsumoto
21d6bfb6dd
test/kernel.rb: disable some Kernel#p tests; ref #6524
2025-05-08 16:21:01 +09:00
HASUMI Hitoshi
fdfd67ff40
Fix Kernel#p when no argument
...
## Expected
```ruby
p
=> nil
```
## Actual
```ruby
p
=> []
```
2025-05-04 10:17:37 +09:00
Yukihiro "Matz" Matsumoto
95b30a38dc
kernel.rb: make Kernel#loop private
2025-03-07 17:17:44 +09:00
Yukihiro "Matz" Matsumoto
ff6149dea7
kernel.c: removed some Kernel singleton methods
...
Since virtually no one calls `Kernel.block_given?` but just
`block_given?`. For the cases `raise` is redefined (like Ruby/Tk),
`Kernel.raise` is kept.
2025-03-07 17:17:44 +09:00
Yukihiro "Matz" Matsumoto
efc03f60af
proc.c: make #lambda private
2025-03-07 17:17:43 +09:00
Yukihiro "Matz" Matsumoto
003e0fb330
mruby-print: disable the gem unless explicitly specified
...
mruby-print is the duplicate of part of mruby-io. You need it only when
limited I/O functionality required.
2025-01-06 13:57:23 +09:00
Yukihiro "Matz" Matsumoto
a109599d53
vm.c (prepare_missing): add receiver's class in superclass calls
2024-11-15 15:15:08 +09:00
Yukihiro "Matz" Matsumoto
65e0e5bbd3
class.c (mrb_method_missing): add receiver's class to clarify
...
We needed to modify a lot of test code that expected the old style.
2024-11-15 15:13:24 +09:00
Yukihiro "Matz" Matsumoto
e4d6917786
test/kernel.rb: remove duplicate tests; ref #5584
2021-11-26 12:18:41 +09:00
dearblue
668b12e756
Check more MRB_ARGS_NONE()
...
The `__id__` method implemented in the C function has `MRB_ARGS_NONE()` specified, but it is also effective in the following cases.
```ruby
p nil.__id__ opts: 1 rescue p :a
p nil.method(:__id__).call 1 rescue p :b
p nil.method(:__id__).call opts: 1 rescue p :c
p nil.method(:__id__).to_proc.call 1 rescue p :d
p nil.method(:__id__).to_proc.call opts: 1 rescue p :e
p nil.method(:__id__).unbind.bind_call nil, 1 rescue p :f
p nil.method(:__id__).unbind.bind_call nil, opts: 1 rescue p :g
p nil.__send__ :__id__, 1 rescue p :h
p nil.__send__ :__id__, opts: 1 rescue p :i
```
After applying this patch, all items will output symbols in the same way as CRuby.
For this purpose, add `MRB_PROC_NOARG` to `struct RProc::flags`.
2021-11-26 12:18:41 +09:00
Yukihiro "Matz" Matsumoto
bda242a135
vm.c: change the default error message for undefined super method.
...
- (old) `undefined method 'foo'`
- (new) `no superclass method 'foo'`
2021-04-01 08:42:30 +09:00
dearblue
80fe9838d2
Integrate Fixnum class into Integer class
...
* The `Fixnum` constant is now an alias for the `Integer` class.
* Remove `struct mrb_state::fixnum_class` member.
If necessary, use `struct mrb_state::integer_class` instead.
2020-10-12 16:21:44 +09:00
dearblue
5dc87f77d4
Fixed shift width for MRB_ENV_SET_BIDX()
...
ref c07f24cd1 and close #5035
2020-07-16 23:11:30 +09:00
dearblue
4cd858f93d
Update test/t/kernel.rb
...
- Remove unnecessoury assert
- Fix typo
2020-06-09 20:33:56 +09:00
Yusuke Endoh
6f4c585bd7
Do not destruct rest arguments for __send__
...
Formerly, `__send__(*args)` modified `args` with `Array#shift`.
This bug affects optcarrot.
This changeset avoids the array destruction by using
`args = args[1, len-1]`.
2020-05-24 01:25:03 +09:00
Yukihiro "Matz" Matsumoto
c181d89c9d
Kernel#clone and Kernel#dup no longer raise TypeError; fix #4974
...
In ISO, those methods should raise `TypeError`, but the spec has been
changed. The change was discussed in [Feature#12979].
2020-04-21 13:21:12 +09:00
Yukihiro "Matz" Matsumoto
2ebc6d5b6f
Merge pull request #4407 from shuujii/add-assert_raise_with_message-and-assert_raise_with_message_pattern
...
Add `assert_raise_with_message` and `assert_raise_with_message_pattern`
2019-07-29 01:05:26 +09:00
KOBAYASHI Shuji
97c9e6b000
Fix include, prepend and extend to frozen object
2019-06-30 15:06:39 +09:00
KOBAYASHI Shuji
ad8473bd66
Add modification tests for immediate value
2019-06-27 18:47:48 +09:00
KOBAYASHI Shuji
c43ff6fa40
Move Kernel#__send__ test to core from mruby-metaprog
2019-06-21 22:02:29 +09:00
KOBAYASHI Shuji
030dd6655e
Fix cvar, ivar, const and method can be removed to frozen object
2019-06-16 20:43:23 +09:00
KOBAYASHI Shuji
4b83fe8b04
Remove Kernel#global_variables from core
...
This method is defined in `mruby-metaprog` gem.
2019-06-07 22:02:43 +09:00
KOBAYASHI Shuji
1fb635ac03
Add assert_raise_with_message and assert_raise_with_message_pattern
2019-04-26 21:48:40 +09:00
KOBAYASHI Shuji
7b0ebed033
Use mrb_immediate_p() in mrb_obj_freeze() and mrb_obj_frozen()
2019-04-10 19:19:53 +09:00
KOBAYASHI Shuji
b588e5a5b7
Fix class/instance variable name validation
...
- `@@?` etc are invalid class variable name.
- `@1` etc are invalid instance variable name.
2019-03-17 16:58:31 +09:00
dearblue
366848996a
Clear terminated space
2018-09-07 22:32:34 +09:00
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
Yukihiro "Matz" Matsumoto
f408143c28
The clone method should copy object status (e.g. frozen) too; #4030
2018-06-01 22:39:40 +09:00
Yukihiro "Matz" Matsumoto
2a5545cc25
Update Kernel#method_missing tests for new NoMethodError message.
...
Also removed tests that depends on implementation details of the default
`method_missing` behavior.
2017-12-23 15:18:13 +09:00
Yukihiro "Matz" Matsumoto
5405b47f41
Update test for Kernel#local_variables
2017-10-28 00:29:30 +09:00
Christopher Aue
731dd78aa0
Added basic test for calling a missing method through super
2017-08-11 14:09:22 +02:00
Yukihiro "Matz" Matsumoto
466a18b0d3
Remove redundant use of Object#to_s in interpolation.
2017-06-28 23:28:24 +09:00
ksss
bd72dba8c0
Kernel#local_variables: Make result array unique
2017-02-06 11:16:47 +09:00
ksss
5c1c002ac2
Fix segv when primitive value
...
Fix #3352
2016-12-25 16:52:10 +09:00
Takashi Kokubun
10bb7ad693
Implement Object#freeze
2016-12-11 03:44:15 +09:00
Bouke van der Bijl
9c61e1cd87
Use mrb_ptr instead of mrb_cptr in Kernel#to_s
...
This is to avoid segfault when WORD_BOXING is enabled
Reported by https://hackerone.com/brakhane
2016-12-01 15:23:56 -05:00
Bouke van der Bijl
73bb30c2f4
Copy over INSTANCE_TT when duping class
2016-11-24 09:52:30 -05:00
Yasuhiro Matsumoto
8a15ab0c0c
add test for public_methods(false)
2016-06-18 01:21:21 +09:00
Yukihiro "Matz" Matsumoto
35d4137da1
remove part of 9cd71916 test for same reason as 5306e47
2014-06-01 02:51:04 +09:00
take_cheeze
d8d07a2345
Move Kernel.local_variables to core.
2014-05-19 22:05:02 +09:00
Carson McDonald
aa2e03cdf6
Add test for remove_instance_variable
2014-05-18 15:53:11 -04:00
take_cheeze
49cf477688
Fix #2259 .
2014-05-16 19:58:36 +09:00
take_cheeze
d0c0beb880
Move __method__ to mruby-kernel-ext since it's not ISO method.
2014-05-09 22:44:10 +09:00
ksss
f0dd4cb673
Implement Kernel#define_singleton_method
2014-03-28 18:16:28 +09:00
ksss
65ace4e027
Implement Kernel#__method__
2014-03-27 18:25:47 +09:00
Jun Hiroe
caa139f91a
Refactor tests in kernel.rb
2014-02-27 23:49:58 +09:00
cubicdaiya
677cd22be1
add test for Kernel#instance_variable_defined?
2014-02-26 22:44:22 +09:00
Pavel
411168deab
Fix Kernel#global_variables for $1-$9
2014-02-09 23:54:49 +07:00
Tomoyuki Sahara
83413218a5
add operator "!~".
2014-01-10 13:41:41 +09:00