From 6b8a83e64a7eee752bef30a4f047e88533aa9138 Mon Sep 17 00:00:00 2001 From: Ilya Bylich Date: Thu, 28 Dec 2023 12:07:50 +0100 Subject: [PATCH] add tests for duplicate variable name check with p_rest --- test/test_parser.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test_parser.rb b/test/test_parser.rb index 476aea5c5..e1c641137 100644 --- a/test/test_parser.rb +++ b/test/test_parser.rb @@ -9797,6 +9797,18 @@ def test_pattern_matching_duplicate_variable_name %q{0 => [a, a]}, %q{ ^ location}, SINCE_3_0) + + assert_diagnoses( + [:error, :duplicate_variable_name, { :name => 'a' }], + %q{0 in [a, *a]}, + %q{ ^ location}, + SINCE_3_3) + + assert_diagnoses( + [:error, :duplicate_variable_name, { :name => 'a' }], + %q{0 in [*a, a, b, *b]}, + %q{ ^ location}, + SINCE_3_3) end def test_pattern_matching_duplicate_hash_keys