1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

parse.y: adjust position of lambda

* parse.y (lambda): adjust position to the beginning of the block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-09-19 07:59:07 +00:00
parent eb568bdee6
commit 5cda4e9071
3 changed files with 34 additions and 2 deletions

View file

@ -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