Skip to content

Commit c0d9a26

Browse files
committed
Add test_eval_object_without_inspect_method
1 parent ce6d53e commit c0d9a26

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/irb/test_context.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,23 @@ def test_eval_input
9898
$VERBOSE = verbose
9999
end
100100

101+
def test_eval_object_without_inspect_method
102+
verbose, $VERBOSE = $VERBOSE, nil
103+
input = TestInputMethod.new([
104+
"BasicObject.new\n",
105+
])
106+
irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input)
107+
out, err = capture_output do
108+
irb.eval_input
109+
end
110+
assert_empty err
111+
assert_pattern_list([:*, /\(Object doesn't support #inspect\)/,
112+
:*, /=> \n/,
113+
/\s*/], out)
114+
ensure
115+
$VERBOSE = verbose
116+
end
117+
101118
def test_default_config
102119
assert_equal(true, @context.use_colorize?)
103120
end

0 commit comments

Comments
 (0)