diff options
| author | tomoya ishida <tomoyapenguin@gmail.com> | 2024-12-04 06:55:27 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-12-03 21:55:33 +0000 |
| commit | e539342f65e468fc7f926277eff61cb8b8a60622 (patch) | |
| tree | f224d57b8e1c249f19d69db777046b0ac1078f98 /test | |
| parent | 3a90663776f94e4a617a4069d1d073cc1eca0526 (diff) | |
[ruby/irb] Don't show 'Maybe IRB bug!' in show_source and ls command
(https://github.com/ruby/irb/pull/1039)
https://github.com/ruby/irb/commit/9eb14a3a0b
Diffstat (limited to 'test')
| -rw-r--r-- | test/irb/command/test_show_source.rb | 13 | ||||
| -rw-r--r-- | test/irb/test_command.rb | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/test/irb/command/test_show_source.rb b/test/irb/command/test_show_source.rb index d014c78fc4..a4227231e4 100644 --- a/test/irb/command/test_show_source.rb +++ b/test/irb/command/test_show_source.rb @@ -65,6 +65,19 @@ module TestIRB assert_match(%r[Couldn't locate a definition for Foo], out) end + def test_show_source_with_eval_error + write_ruby <<~'RUBY' + binding.irb + RUBY + + out = run_ruby_file do + type "show_source raise(Exception).itself" + type "exit" + end + + assert_match(%r[Couldn't locate a definition for raise\(Exception\)\.itself], out) + end + def test_show_source_string write_ruby <<~'RUBY' binding.irb diff --git a/test/irb/test_command.rb b/test/irb/test_command.rb index 69931e3e4f..21e05752b9 100644 --- a/test/irb/test_command.rb +++ b/test/irb/test_command.rb @@ -742,6 +742,19 @@ module TestIRB end end + def test_ls_with_eval_error + [ + "ls raise(Exception,'foo')\n", + "ls raise(Exception,'foo'), grep: /./\n", + "ls Integer, grep: raise(Exception,'foo')\n", + ].each do |line| + out, err = execute_lines(line) + assert_empty err + assert_match(/Exception: foo/, out) + assert_not_match(/Maybe IRB bug!/, out) + end + end + def test_ls_with_no_singleton_class out, err = execute_lines( "ls 42", |
