File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -223,7 +223,10 @@ def each_top_level_statement
223
223
throw :TERM_INPUT if @line == ''
224
224
else
225
225
@line_no += l . count ( "\n " )
226
- next if l == "\n "
226
+ if l == "\n "
227
+ @exp_line_no += 1
228
+ next
229
+ end
227
230
@line . concat l
228
231
if @code_block_open or @ltype or @continue or @indent > 0
229
232
next
Original file line number Diff line number Diff line change @@ -572,5 +572,26 @@ def test_eval_input_with_long_exception
572
572
ensure
573
573
$VERBOSE = verbose
574
574
end
575
+
576
+ def test_lineno
577
+ input = TestInputMethod . new ( [
578
+ "\n " ,
579
+ "__LINE__\n " ,
580
+ "__LINE__\n " ,
581
+ "\n " ,
582
+ "\n " ,
583
+ "__LINE__\n " ,
584
+ ] )
585
+ irb = IRB ::Irb . new ( IRB ::WorkSpace . new ( Object . new ) , input )
586
+ out , err = capture_output do
587
+ irb . eval_input
588
+ end
589
+ assert_empty err
590
+ assert_pattern_list ( [
591
+ :* , /\b 2\n / ,
592
+ :* , /\b 3\n / ,
593
+ :* , /\b 6\n / ,
594
+ ] , out )
595
+ end
575
596
end
576
597
end
You can’t perform that action at this time.
0 commit comments