Skip to content

Commit

Permalink
Add test cases for duplicated `when\' clause warnings
Browse files Browse the repository at this point in the history
Add test cases for `__LINE__` and `__FILE__` because
they were managed by NODE_LIT and NODE_STR but changed to
be managed by dedicated NODE now.
  • Loading branch information
yui-knk committed Jan 5, 2024
1 parent 098d97e commit 6d67dfc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/ruby/test_syntax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,24 @@ def test_duplicated_when
end
}
}
assert_warning(/3: #{w}.+4: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m) {
eval %q{
case 1
when __LINE__, __LINE__
when 3, 3
when 3, 3
end
}
}
assert_warning(/3: #{w}.+4: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m) {
eval %q{
case 1
when __FILE__, __FILE__
when "filename", "filename"
when "filename", "filename"
end
}, binding, "filename"
}
end

def test_duplicated_when_check_option
Expand Down

0 comments on commit 6d67dfc

Please sign in to comment.