File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -574,6 +574,8 @@ def eval_input
574574 next
575575 end
576576 handle_exception ( exc )
577+ @context . workspace . local_variable_set ( :_ , exc )
578+ exc = nil
577579 end
578580 end
579581 end
Original file line number Diff line number Diff line change @@ -105,6 +105,24 @@ def test_eval_input
105105 $VERBOSE = verbose
106106 end
107107
108+ def test_eval_input_raise2x
109+ input = TestInputMethod . new ( [
110+ "raise 'Foo'\n " ,
111+ "raise 'Bar'\n " ,
112+ "_\n " ,
113+ ] )
114+ irb = IRB ::Irb . new ( IRB ::WorkSpace . new ( Object . new ) , input )
115+ out , err = capture_output do
116+ irb . eval_input
117+ end
118+ assert_empty err
119+ assert_pattern_list ( [
120+ :* , /\( irb\) :1:in `<main>': Foo \( RuntimeError\) \n / ,
121+ :* , /\( irb\) :2:in `<main>': Bar \( RuntimeError\) \n / ,
122+ :* , /#<RuntimeError: Bar>\n / ,
123+ ] , out )
124+ end
125+
108126 def test_eval_object_without_inspect_method
109127 verbose , $VERBOSE = $VERBOSE, nil
110128 all_assertions do |all |
You can’t perform that action at this time.
0 commit comments