44 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 32a27216bb test: add parentheses to method calls on assignment RHS
Preparation for future grammar simplification that may
require parentheses for method calls with arguments on
the right-hand side of assignments.

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-27 14:58:14 +09:00
Yukihiro "Matz" Matsumoto a87b4b6bc3 test/exception.rb: update for new Exception#inspect 2025-05-07 12:19:05 +09:00
Yukihiro "Matz" Matsumoto f82cd188b0 test/exception.rb: call #initialize via #__send__ to skip private check 2025-03-07 17:17:39 +09:00
fundamental c146e81c4a Disable tests on backtraces w/ unknown line numbers 2021-03-30 20:26:10 -04:00
Yukihiro "Matz" Matsumoto 364c47610f Fixed backtrace message for top-level blocks; fix #4936
In top-level, `mid` is `NULL`. We used to ignore 'mid` update for `NULL`.
2020-01-27 14:34:54 +09:00
KOBAYASHI Shuji d2f2f9db51 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)
  ```
2019-12-14 22:29:37 +09:00
KOBAYASHI Shuji 8b951710fe Use __send__ instead of send; ref #4207 2019-01-12 22:21:34 +09:00
Yukihiro "Matz" Matsumoto d2458e66c2 Remove class info from backtrace lines. 2017-05-23 23:50:42 +09:00
Yukihiro "Matz" Matsumoto 8d1468eab4 Remove cname duplication from exc_inspect(). 2017-03-19 08:05:19 +09:00
Yukihiro "Matz" Matsumoto 6c299aae67 fixed wrong stack adjustment for ensure clauses; fix #3175 2016-11-07 00:44:08 +09:00
Franck Verrot f6a2f67648 Correct method name 2016-08-15 20:49:32 -07:00
Kouhei Sutou 0ebac02813 Skip backtrace related tests when backtrace isn't available 2015-12-29 23:26:31 +09:00
Kouhei Sutou a561bdb25f Support backtrace after method calls
GitHub: fix #2902, #2917

The current implementation traverses stack to retrieve backtrace. But
stack will be changed when some operations are occurred. It means that
backtrace may be broken after some operations.

This change (1) saves the minimum information to retrieve backtrace when
exception is raised and (2) restores backtrace from the minimum
information when backtrace is needed. It reduces overhead for creating
backtrace Ruby objects.

The space for the minimum information is reused by multiple
exceptions. So memory allocation isn't occurred for each exception.
2015-12-29 20:36:12 +09:00
take_cheeze ec5b055694 Move direct superclass checking to test/t/superclass.rb. 2014-06-15 15:02:21 +09:00
ksss bc0cf69a83 Exception#exception fix test
Exception.exception is not call Exception#exception.
Test for Exception#exception should call Exception#exception method.
2014-05-25 11:18:39 +09:00
yui-knk 756bfa6cd2 Correct comment in exception test. 2014-05-20 23:02:47 +09:00
Yukihiro "Matz" Matsumoto 4b6de9dea6 update raise in ensure test 2014-05-20 11:25:17 +09:00
Yukihiro "Matz" Matsumoto 3fc8f0435a correct comment; ref #2297 2014-05-20 11:24:15 +09:00
Yukihiro "Matz" Matsumoto b0477f1d3f Merge branch 'add-exception-test' of https://github.com/yui-knk/mruby into yui-knk-add-exception-test 2014-05-20 11:22:49 +09:00
yui-knk f55851cb74 Add 'Raise in rescue' test to exception. 2014-05-20 00:02:03 +09:00
yui-knk 1a00a34cc2 Delete unused NameError#new. And add test. 2014-05-10 01:12:52 +09:00
yui-knk 8b6bfd1a25 Add assert to Exception#inspect test. 2014-05-10 00:07:20 +09:00
yui-knk faee698746 Refactoring test to use assert_nothing_raised. 2014-05-09 23:40:41 +09:00
yui-knk ff90bb1c18 Refactoring exception test.
Change to use assert_equal explicitly.
2014-05-05 09:52:29 +09:00
Carson McDonald 072d98dd94 Test for raise in ensure 2014-01-05 09:20:31 -05:00
Yukihiro "Matz" Matsumoto 2fe64f24f8 remove Exception#verbose_backtrace; #1495 2013-09-03 15:52:35 +09:00
take_cheeze d12b6ab218 add verbose_backtrace 2013-09-02 00:48:06 +09:00
take_cheeze 596cd3f6e7 add Exception#backtrace test 2013-09-02 00:48:05 +09:00
Jun Hiroe 363d65ccef I fix order of actual and expect test value in exception.rb. 2013-08-02 20:54:11 +09:00
Daniel Bovensiepen 2657fc4b8a Improve Exception tests 2013-06-09 05:25:52 +08:00
Tomoyuki Sahara 7626508f62 catching NameError here is not desirable. 2013-04-17 13:25:36 +09:00
Tomoyuki Sahara 0f8969041a rollback stack before executing ensure clause. 2013-04-17 13:08:54 +09:00
Yukihiro "Matz" Matsumoto 5306e4716e although I understand the intntion of 039679f1, consuming all memory in the test program is not a good idea 2013-04-09 13:39:25 +09:00
Masamitsu MURASE f413e6881c Increase TEST_INFINITE_RECURSION_MAX value from 100000 to 1000000 because modification of handling of NODE_RETURN reduces stack size. 2013-02-27 03:45:11 +09:00
Masamitsu MURASE efa18038de Add more tests for begin and rescue. 2013-02-25 00:25:03 +09:00
Beoran 039679f1af Keep stack depth and allocation better under control and fix crash on infinite recursion. 2012-11-22 11:02:17 +01:00
Yukihiro Matsumoto f166f63f45 add test case for 750b7c2 2012-10-20 08:50:51 +09:00
Tomoyuki Sahara 7a7f267b88 check if an Exception instance has a "mesg" attribute
fix the issue that "Exception.new.inspect" causes SIGSEGV.
2012-09-12 20:08:56 +09:00
Masamitsu MURASE 686b6eb629 Add more test for exception. 2012-08-13 01:57:00 +09:00
Yukihiro Matsumoto 39f47c1915 remove LoadError 2012-06-15 13:55:27 +09:00
Masaki Muranaka cfd5f5157d Move Subclasses of ScriptError to mrblib. 2012-06-15 13:06:43 +09:00
Daniel Bovensiepen c78dc2930c Add superclass tests for Exceptions 2012-06-03 23:31:17 +08:00
Kazuki Tsujimoto 0629cf21ba A rescue clause with no parameter list rescues only StandardErrors 2012-06-03 17:48:02 +09:00
Daniel Bovensiepen 150b235fb6 Add Tests for all Exception classes, for false, true, Proc, Module, nil and Object 2012-05-25 14:01:14 +08:00