summaryrefslogtreecommitdiff
path: root/test/irb
diff options
context:
space:
mode:
authorNobuhiro IMAI <nov@yo.rim.or.jp>2020-03-24 15:24:01 +0900
committergit <svn-admin@ruby-lang.org>2021-02-03 00:09:32 +0900
commitb0fb2082187fe3cd247a92471aa42d3e6f779e51 (patch)
tree80fa55d60240797084b0ed47336cf4df92ad6247 /test/irb
parent739f9297c562a387aa012bad781ac2f07f434c1e (diff)
[ruby/irb] follow up the actual line number
https://github.com/ruby/irb/commit/7aed8fe3b1
Diffstat (limited to 'test/irb')
-rw-r--r--test/irb/test_context.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/irb/test_context.rb b/test/irb/test_context.rb
index 63e71e5..71e8ad1 100644
--- a/test/irb/test_context.rb
+++ b/test/irb/test_context.rb
@@ -572,5 +572,26 @@ module TestIRB
ensure
$VERBOSE = verbose
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