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
574
574
next
575
575
end
576
576
handle_exception ( exc )
577
+ @context . workspace . local_variable_set ( :_ , exc )
578
+ exc = nil
577
579
end
578
580
end
579
581
end
Original file line number Diff line number Diff line change @@ -105,6 +105,24 @@ def test_eval_input
105
105
$VERBOSE = verbose
106
106
end
107
107
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
+
108
126
def test_eval_object_without_inspect_method
109
127
verbose , $VERBOSE = $VERBOSE, nil
110
128
all_assertions do |all |
You can’t perform that action at this time.
0 commit comments