summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authoryui-knk <spiketeika@gmail.com>2024-01-05 09:48:41 +0900
committerYuichiro Kaneko <spiketeika@gmail.com>2024-01-05 12:14:13 +0900
commit6d67dfc9ea9d90e660f9478ca0f503fbf4e57128 (patch)
tree16245653a009ab0646e8279734dbe8928d355582 /test/ruby
parent098d97e96d1519154c2a845db558b104abe3ab7e (diff)
Add test cases for duplicated `when\' clause warnings
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.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_syntax.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index bd350ba223..7ca7e2bcf7 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -717,6 +717,24 @@ WARN
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