[ruby/irb] follow up the actual line number
https://github.com/ruby/irb/commit/7aed8fe3b1
This commit is contained in:
parent
739f9297c5
commit
b0fb208218
@ -223,7 +223,10 @@ class RubyLex
|
|||||||
throw :TERM_INPUT if @line == ''
|
throw :TERM_INPUT if @line == ''
|
||||||
else
|
else
|
||||||
@line_no += l.count("\n")
|
@line_no += l.count("\n")
|
||||||
next if l == "\n"
|
if l == "\n"
|
||||||
|
@exp_line_no += 1
|
||||||
|
next
|
||||||
|
end
|
||||||
@line.concat l
|
@line.concat l
|
||||||
if @code_block_open or @ltype or @continue or @indent > 0
|
if @code_block_open or @ltype or @continue or @indent > 0
|
||||||
next
|
next
|
||||||
|
@ -572,5 +572,26 @@ module TestIRB
|
|||||||
ensure
|
ensure
|
||||||
$VERBOSE = verbose
|
$VERBOSE = verbose
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_lineno
|
||||||
|
input = TestInputMethod.new([
|
||||||
|
"\n",
|
||||||
|
"__LINE__\n",
|
||||||
|
"__LINE__\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"__LINE__\n",
|
||||||
|
])
|
||||||
|
irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input)
|
||||||
|
out, err = capture_output do
|
||||||
|
irb.eval_input
|
||||||
|
end
|
||||||
|
assert_empty err
|
||||||
|
assert_pattern_list([
|
||||||
|
:*, /\b2\n/,
|
||||||
|
:*, /\b3\n/,
|
||||||
|
:*, /\b6\n/,
|
||||||
|
], out)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user