diff options
| author | tomoya ishida <tomoyapenguin@gmail.com> | 2024-02-12 20:28:50 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-02-12 11:28:54 +0000 |
| commit | 06995eb45b86645a945b4429c6d85597a21b40a7 (patch) | |
| tree | f033a9257f4b8fad9cbfb63c7d68b80f564d8767 /test | |
| parent | 39788e5888c8117b07a4c06390d08ce032d9a42b (diff) | |
[ruby/irb] Fix exit! command warning and method behavior
(https://github.com/ruby/irb/pull/868)
* Fix exit! command warning and method behavior
* Remove arg(0) from Kernel.exit and Kernel.exit!
https://github.com/ruby/irb/commit/372bc59bf5
Diffstat (limited to 'test')
| -rw-r--r-- | test/irb/cmd/test_force_exit.rb | 12 | ||||
| -rw-r--r-- | test/irb/test_cmd.rb | 4 |
2 files changed, 13 insertions, 3 deletions
diff --git a/test/irb/cmd/test_force_exit.rb b/test/irb/cmd/test_force_exit.rb index 191a786872..9e86c644d6 100644 --- a/test/irb/cmd/test_force_exit.rb +++ b/test/irb/cmd/test_force_exit.rb @@ -47,5 +47,17 @@ module TestIRB assert_match(/irb\(main\):001> 123/, output) end + + def test_forced_exit_out_of_irb_session + write_ruby <<~'ruby' + at_exit { puts 'un' + 'reachable' } + binding.irb + exit! # this will call exit! method overrided by command + ruby + output = run_ruby_file do + type "exit" + end + assert_not_include(output, 'unreachable') + end end end diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb index 7d7353281e..349d2c0457 100644 --- a/test/irb/test_cmd.rb +++ b/test/irb/test_cmd.rb @@ -58,9 +58,7 @@ module TestIRB "irb_info", main: main ) - # Because the main object is frozen, IRB would wrap a delegator around it - # Which's exit! method can't be overridden and would raise a warning - assert_match(/delegator does not forward private method #exit\!/, err) + assert_empty(err) assert_match(/RUBY_PLATFORM/, out) end end |
