summaryrefslogtreecommitdiff
path: root/test/irb/test_context.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/irb/test_context.rb')
-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 63e71e5867..71e8ad1c0d 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