@@ -129,7 +129,6 @@ def test_output_to_pipe
129129 failed : [
130130 [ false , "BasicObject.new" , /#<NoMethodError: undefined method `to_s' for/ ] ,
131131 [ :p , "class Foo; undef inspect ;end; Foo.new" , /#<NoMethodError: undefined method `inspect' for/ ] ,
132- [ true , "BasicObject.new" , /#<NoMethodError: undefined method `is_a\? ' for/ ] ,
133132 [ :yaml , "BasicObject.new" , /#<NoMethodError: undefined method `inspect' for/ ] ,
134133 [ :marshal , "[Object.new, Class.new]" , /#<TypeError: can't dump anonymous class #<Class:/ ]
135134 ]
@@ -150,6 +149,19 @@ def test_output_to_pipe
150149 end
151150 end
152151
152+ def test_object_inspection_handles_basic_object
153+ verbose , $VERBOSE = $VERBOSE, nil
154+ irb = IRB ::Irb . new ( IRB ::WorkSpace . new ( Object . new ) , TestInputMethod . new ( [ "BasicObject.new" ] ) )
155+ out , err = capture_output do
156+ irb . eval_input
157+ end
158+ assert_empty err
159+ assert_not_match ( /NoMethodError/ , out )
160+ assert_match ( /#<BasicObject:.*>/ , out )
161+ ensure
162+ $VERBOSE = verbose
163+ end
164+
153165 def test_object_inspection_falls_back_to_kernel_inspect_when_errored
154166 verbose , $VERBOSE = $VERBOSE, nil
155167 main = Object . new
0 commit comments