summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_lambda.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_lambda.rb b/test/ruby/test_lambda.rb
index f042ab015e..6023c3fcc8 100644
--- a/test/ruby/test_lambda.rb
+++ b/test/ruby/test_lambda.rb
@@ -109,4 +109,28 @@ class TestLambdaParameters < Test::Unit::TestCase
assert_equal(42, return_in_current(42), feature8693)
assert_equal(42, return_in_callee(42), feature8693)
end
+
+ def test_do_lambda_source_location
+ exp_lineno = __LINE__ + 3
+ lmd = ->(x,
+ y,
+ z) do
+ #
+ end
+ file, lineno = lmd.source_location
+ assert_match(/^#{ Regexp.quote(__FILE__) }$/, file)
+ assert_equal(exp_lineno, lineno, "must be ")
+ end
+
+ def test_brace_lambda_source_location
+ exp_lineno = __LINE__ + 3
+ lmd = ->(x,
+ y,
+ z) {
+ #
+ }
+ file, lineno = lmd.source_location
+ assert_match(/^#{ Regexp.quote(__FILE__) }$/, file)
+ assert_equal(exp_lineno, lineno, "must be ")
+ end
end