mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix the lineno of case statement that has no expression
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1f7abf7283
commit
3155da024c
2 changed files with 6 additions and 1 deletions
5
parse.y
5
parse.y
|
@ -2687,6 +2687,7 @@ primary : literal
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_CASE(0, $3);
|
$$ = NEW_CASE(0, $3);
|
||||||
|
nd_set_line($3, $<num>1);
|
||||||
/*%
|
/*%
|
||||||
$$ = dispatch2(case, Qnil, $3);
|
$$ = dispatch2(case, Qnil, $3);
|
||||||
%*/
|
%*/
|
||||||
|
@ -2937,6 +2938,10 @@ k_until : keyword_until
|
||||||
k_case : keyword_case
|
k_case : keyword_case
|
||||||
{
|
{
|
||||||
token_info_push("case");
|
token_info_push("case");
|
||||||
|
/*%%%*/
|
||||||
|
$<num>$ = ruby_sourceline;
|
||||||
|
/*%
|
||||||
|
%*/
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@ class TestCoverage < Test::Unit::TestCase
|
||||||
f.puts 'foo(2)'
|
f.puts 'foo(2)'
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_in_out_err(%w[-W0 -rcoverage], <<-"end;", ["{:branches=>{[:case, 0, 2]=>{[:when, 1, 4]=>2, [:when, 2, 6]=>0, [:else, 3, 2]=>1}, [:case, 4, 14]=>{[:when, 5, 11]=>2, [:when, 6, 13]=>0, [:else, 7, 14]=>1}, [:case, 8, 16]=>{[:when, 9, 18]=>2, [:when, 10, 20]=>0, [:else, 11, 22]=>1}, [:case, 12, 32]=>{[:when, 13, 27]=>2, [:when, 14, 29]=>0, [:else, 15, 31]=>1}}}"], [])
|
assert_in_out_err(%w[-W0 -rcoverage], <<-"end;", ["{:branches=>{[:case, 0, 2]=>{[:when, 1, 4]=>2, [:when, 2, 6]=>0, [:else, 3, 2]=>1}, [:case, 4, 9]=>{[:when, 5, 11]=>2, [:when, 6, 13]=>0, [:else, 7, 9]=>1}, [:case, 8, 16]=>{[:when, 9, 18]=>2, [:when, 10, 20]=>0, [:else, 11, 22]=>1}, [:case, 12, 25]=>{[:when, 13, 27]=>2, [:when, 14, 29]=>0, [:else, 15, 31]=>1}}}"], [])
|
||||||
ENV["COVERAGE_EXPERIMENTAL_MODE"] = "true"
|
ENV["COVERAGE_EXPERIMENTAL_MODE"] = "true"
|
||||||
Coverage.start(branches: true)
|
Coverage.start(branches: true)
|
||||||
tmp = Dir.pwd
|
tmp = Dir.pwd
|
||||||
|
|
Loading…
Add table
Reference in a new issue