Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when inspect is called but not found in inspector #109

Merged
merged 2 commits into from
Jun 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/irb/inspector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def inspect_value(v)
result
rescue NoMethodError
puts "(Object doesn't support #inspect)"
''
end
}
Inspector.def_inspector([:pp, :pretty_inspect], proc{require "pp"}){|v|
Expand Down
17 changes: 17 additions & 0 deletions test/irb/test_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@ def test_eval_input
$VERBOSE = verbose
end

def test_eval_object_without_inspect_method
verbose, $VERBOSE = $VERBOSE, nil
input = TestInputMethod.new([
"BasicObject.new\n",
])
irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input)
out, err = capture_output do
irb.eval_input
end
assert_empty err
assert_pattern_list([:*, /\(Object doesn't support #inspect\)/,
:*, /=> \n/,
/\s*/], out)
ensure
$VERBOSE = verbose
end

def test_default_config
assert_equal(true, @context.use_colorize?)
end
Expand Down