25 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 4a0e80601f mruby-kernel-ext: make Kernel methods private
- fail
- caller
= __method__
- __callee__
- Integer
= Float
- String
- Array
- Hash
2025-03-07 17:17:45 +09:00
Yukihiro "Matz" Matsumoto 53a8472e5e mruby-kernel-ext/test: skip some tests that related to alias callee.
The last commit changed the behavior of aliases, and we no longer keep
the alias name symbol but the original name. Since this is a small
incompatibility from CRuby and it requires some memory to fix this, we
keep this issue right now.
2023-11-21 09:37:17 +09:00
Yukihiro "Matz" Matsumoto 28c4f2f683 kernel.c: add __method__; ref #4468 2021-09-04 17:57:35 +09:00
KOBAYASHI Shuji 8a9f891fd3 Rename Kernel#__method__ to Kernel#__callee__
Because the current behavior of `__method__` is equivalent to `__callee__`.

Example:

  # example.rb
  def src
    __send__(ARGV[0])
  end
  alias dst src
  %w[src dst].each {|n| puts "call #{n} => #{__send__(n).inspect}"}

  Ruby:

    $ ruby example.rb __method__
    call src => :src
    call dst => :src

    $ ruby example.rb __callee__
    call src => :src
    call dst => :dst

  mruby:

    $ mruby example.rb __method__
    call src => :src
    call dst => :dst
2021-09-04 16:17:06 +09:00
John Bampton 9d32d440eb feat(CI): add the GitHub Super Linter
The GitHub Super Linter is a more robust and better supported
tool than the current GitHub Actions we are using.

Running these checks:

ERROR_ON_MISSING_EXEC_BIT: true
VALIDATE_BASH: true
VALIDATE_BASH_EXEC: true
VALIDATE_EDITORCONFIG: true
VALIDATE_MARKDOWN: true
VALIDATE_SHELL_SHFMT: true
VALIDATE_YAML: true

https://github.com/marketplace/actions/super-linter
https://github.com/github/super-linter

Added the GitHub Super Linter badge to the README.

Also updated the pre-commit framework and added
more documentation on pre-commit.

Added one more pre-commit check: check-executables-have-shebangs

Added one extra check for merge conflicts to our
GitHub Actions.

EditorConfig and Markdown linting.

Minor grammar and spelling fixes.

Update linter.yml
2021-04-16 16:37:52 +09:00
fundamental c146e81c4a Disable tests on backtraces w/ unknown line numbers 2021-03-30 20:26:10 -04:00
Yukihiro "Matz" Matsumoto ccf28775b8 Fix mrb_str_len_to_dbl to support Hexadecimal like 0x10. 2020-01-06 15:52:39 +09:00
KOBAYASHI Shuji 7192429e83 Fix behavior of Kernel#Integer to numbers ending with _ and spaces
#### Before this patch:

  ```ruby
  Integer("1_ ")  #=> 1
  ```

#### After this patch (same as Ruby):

  ```ruby
  Integer("1_ ")  #=> ArgumentError
  ```
2019-12-11 16:40:39 +09:00
KOBAYASHI Shuji bf431e77b8 Fix behavior of String#to_i/Kernel#Integer to numbers starting with _
#### 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
  ```
2019-12-10 21:31:30 +09:00
KOBAYASHI Shuji 0893ee492c 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
2019-12-09 21:47:59 +09:00
KOBAYASHI Shuji 1975dedb21 Use mrb_string_value_cstr in mrb_str_to_dbl 2019-05-08 20:35:03 +09:00
Yukihiro "Matz" Matsumoto cca19532c5 Remove Kernel#class_defined? which is not available in CRuby; #3829 2019-01-03 11:34:35 +09:00
YAMAMOTO Masaya b70d69de09 Support MRB_WIHTOUT_FLOAT to mruby-kernel-ext 2017-10-16 18:15:47 +09:00
Yukihiro "Matz" Matsumoto d2458e66c2 Remove class info from backtrace lines. 2017-05-23 23:50:42 +09:00
ksss b1c5c3b0a5 Fix lost lineno 2017-03-25 15:56:27 +09:00
ksss 59d9f313df Skip when backtrace doesn't get 2017-01-14 22:01:20 +09:00
ksss 6f9cb7406a Implement Kernel.#caller 2017-01-14 22:01:20 +09:00
Syohei YOSHIDA 2a661ac612 Add tests which passes all zero string to Kernel#Integer 2016-01-14 11:05:03 +09:00
Jun Hiroe 28c804621a Add Kernel.Integer 2014-10-29 01:30:30 +09:00
Jun Hiroe 140e9bbf4b Add Kernel.Float 2014-10-24 01:55:55 +09:00
Jun Hiroe 9e05366451 Add Kernel.Hash 2014-10-21 23:48:44 +09:00
Jun Hiroe de04d3f080 Add Kernel.String 2014-10-20 22:35:58 +09:00
Jun Hiroe b6edf24a01 Add Kernel.Array 2014-10-19 19:25:31 +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
take_cheeze 208bafba2d Move Kernel#fail definition to mruby-kernel-ext mrbgem. 2014-05-07 00:01:30 +09:00