| Age | Commit message (Collapse) | Author |
|
ref c07f24cd1 and close #5035
|
|
- Remove unnecessoury assert
- Fix typo
|
|
Check if the constant GEMNAME is defined before use in `assert.rb`.
This is added to prevent an undefined constant error when using
`assert.rb` in other environments - for example, testing CRuby.
|
|
Backtrace is useful for debugging.
|
|
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]`.
|
|
|
|
In ISO, those methods should raise `TypeError`, but the spec has been
changed. The change was discussed in [Feature#12979].
|
|
In top-level, `mid` is `NULL`. We used to ignore 'mid` update for `NULL`.
|
|
`mruby` does not warn like `CRuby` for cases like #4893.
Fix #4890, fix #4891, fix #4893.
|
|
#### Before this patch:
```console
$ bin/mruby rb -e '_0=:l; p ->{_0}.()'
-e:1:13: _0 is not available
-e:1:13: syntax error, unexpected $end, expecting '}'
```
#### After this patch (same as Ruby):
```console
$ bin/mruby rb -e '_0=:l; p ->{_0}.()'
:l
```
|
|
Avoid creating `Data` object that refers `mruby` objects.
Also close #4622 ref #4613
|
|
This reverts commit f507ff4842b92a60c0c600fa1f29efdf2688c877.
It makes AppVeyor tests fail.
|
|
shuujii/remove-location-info-from-Exception-inspect
Remove location info from `Exception#inspect`
|
|
|
|
Because location info (file name and line number) is kept in the backtrace,
it should not be kept in the result of `inspect` (and the exception object
itself), I think.
### Example
```ruby
# example.rb
begin
raise "err"
rescue => e
p e
end
```
#### Before this patch:
```
$ bin/mruby example.rb
example.rb:2: err (RuntimeError)
```
#### After this patch:
```
$ bin/mruby example.rb
err (RuntimeError)
```
|
|
#### Before this patch:
```ruby
Integer("1_ ") #=> 1
```
#### After this patch (same as Ruby):
```ruby
Integer("1_ ") #=> ArgumentError
```
|
|
#### Before this patch:
```ruby
Integer("_1") #=> 1
"_1".to_i #=> 1
```
#### After this patch (same as Ruby):
```ruby
Integer("_1") #=> ArgumentError
"_1".to_i #=> 0
```
|
|
shuujii/fix-that-String-to_f-accepts-consecutive-_-as-a-numeric-expression
Fix that `String#to_f` accepts consecutive `_` as a numeric expression
|
|
Consecutive `_` is not allowed as a numeric expression:
1_2__3 #=> SyntaxError
Float("1_2__3") #=> ArgumentError
Integer("1_2__3") #=> ArgumentError
"1_2__3".to_i #=> 12
But `String#to_f` accept it, so I fixed the issue.
Before this patch:
"1_2__3".to_f #=> 123
After this patch:
"1_2__3".to_f #=> 12
|
|
|
|
|
|
|
|
|
|
|
|
Also fix document about type of the first argument.
|
|
- Skip when `MRB_WITHOUT_FLOAT` is defined.
- Make `Fixnum` overflow even when `MRB_INT64` is defined.
|
|
Also fix document about type of the first argument.
|
|
Before this patch:
$ bin/mruby -e 'p 3.to_s(2)'
trace (most recent call last):
[0] -e:1
-e:1: 'to_s': wrong number of arguments (1 for 0) (ArgumentError)
After this patch:
$ bin/mruby -e 'p 3.to_s(2)'
"11"
|
|
|
|
Since in mruby, Integer and Float interchange frequently (mostly on
overflow), so adding explicit `.0` can cause problems sometimes.
For example:
https://github.com/mattn/mruby-json/pull/40
https://github.com/pepabo/mruby-msd/pull/13
https://github.com/mattn/mruby-json/pull/42
|
|
|
|
|
|
|
|
- `size_t` is more commonly used.
- `len` argument of `mrb_str_new()` is `size_t`.
NOTE:
The test for `%l` is temporarily disabled because adding a new type to
`mrbgems/mruby-test/vformat.c` causes an error (memory error?) on Visual
Studio 2017 in AppVeyor.
|
|
It potentially not work when `mrb_float` is `float` because `float` variable
in variable length arguments is promoted to `double`.
Also I fixed build with `MRB_WITHOUT_FLOAT`.
|
|
It potentially breaks, for example, in the case of `mrb_int` is 64-bit
and more smaller type is passed by `%d`. In fact, the problem could
become apparent when I used `%d` to `backtrace_location::lineno` in
`src/backtrace.c:mrb_unpack_backtrace()` on AppVeyor.
Therefore, change `%d` for `int` (not `mrb_int`) so that it can be
used mostly without casting.
|
|
Format sequence syntax:
%[modifier]specifier
Modifiers:
----------+------------------------------------------------------------
Modifier | Meaning
----------+------------------------------------------------------------
! | Convert to string by corresponding `inspect` instead of
| corresponding `to_s`.
----------+------------------------------------------------------------
Specifiers:
----------+----------------+--------------------------------------------
Specifier | Argument Type | Note
----------+----------------+--------------------------------------------
c | char |
d,i | mrb_int |
f | mrb_float |
l | char*, mrb_int | Arguments are string and length.
n | mrb_sym |
s | char* | Argument is NUL terminated string.
t | mrb_value | Convert to type (class) of object.
v,S | mrb_value |
C | struct RClass* |
T | mrb_value | Convert to real type (class) of object.
Y | mrb_value | Same as `!v` if argument is `true`, `false`
| | or `nil`, otherwise same as `T`.
% | - | Convert to percent sign itself (no argument
| | taken).
----------+----------------+--------------------------------------------
This change will increase the binary size, but replacing all format strings
with new specifiers/modifiers will decrease the size because it reduces
inline expansion of `mrb_obj_value()`, etc. at the caller.
|
|
Refine message to `skip` in nested `assert`
|
|
- I think "Info" is used only to `skip`, so change to "Skip".
- Changed the default value of `assert` and specify the argument explicitly
at the caller of `assert` because it is unnatural "Assertion failed" is
output even though the assertion doesn't fail.
== Example:
def assert_foo(exp, act)
assert do
assert_equal exp[0], act[0]
assert_equal exp[1], act[1]
end
end
def assert_bar(exp, act)
assert do
skip
end
end
def assert_baz(exp, act)
assert do
assert_equal exp, act
assert_bar exp, act
end
end
assert 'test#skip_in_nested_assert' do
assert_baz 1, 1
end
=== Before this patch:
?..
Info: test#skip_in_nested_assert (core)
- Assertion[1]
Info: Assertion failed (core)
- Assertion[1-2]
Skip: Assertion failed (core)
Total: 3
OK: 2
KO: 0
Crash: 0
Warning: 0
Skip: 1
=== After this patch:
???
Skip: test#skip_in_nested_assert (core)
- Assertion[1]
Skip: assert (core)
- Assertion[1-2]
Skip: assert (core)
Total: 3
OK: 0
KO: 0
Crash: 0
Warning: 0
Skip: 3
|
|
|
|
|
|
shuujii/add-assert_raise_with_message-and-assert_raise_with_message_pattern
Add `assert_raise_with_message` and `assert_raise_with_message_pattern`
|
|
|
|
Before this patch:
$ bin/mruby -e 'p Module.new.freeze.dup.frozen?' #=> true
After this patch (same as Ruby):
$ bin/mruby -e 'p Module.new.freeze.dup.frozen?' #=> false
|
|
|
|
|
|
|
|
It's an error in ISO specification; 15.3.2.2.4 and 15.3.2.2.7
|
|
|
|
|