summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorKazuki Tsujimoto <kazuki@callcc.net>2023-03-26 15:33:43 +0900
committerKazuki Tsujimoto <kazuki@callcc.net>2023-03-26 18:56:21 +0900
commit6c0925ba7017efde6091e2ec4f1a6be268166696 (patch)
tree86ff05358931208c74bdf994bfa004bbf3bd2bdd /test/ruby
parent2f916812a9b818b432ee7c299e021ec62d4727fb (diff)
downloadruby-6c0925ba7017efde6091e2ec4f1a6be268166696.tar.gz
[Bug #19175] p_rest should be `assignable'
It should also check for duplicate names.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_pattern_matching.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb
index 0337e5d945..a5083ffabd 100644
--- a/test/ruby/test_pattern_matching.rb
+++ b/test/ruby/test_pattern_matching.rb
@@ -800,6 +800,10 @@ END
true
end
end
+
+ assert_syntax_error(%q{
+ 0 => [a, *a]
+ }, /duplicated variable name/)
end
def test_find_pattern
@@ -868,6 +872,10 @@ END
false
end
end
+
+ assert_syntax_error(%q{
+ 0 => [*a, a, b, *b]
+ }, /duplicated variable name/)
end
def test_hash_pattern