summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorydah <t.yudai92@gmail.com>2025-01-08 23:58:59 +0900
committergit <svn-admin@ruby-lang.org>2025-01-08 17:23:51 +0000
commit500a87756f9873a320aa3a11ab2d1ac4e1b4afee (patch)
tree76c0bea620aac49178544c7a70adce405b3cab5c /test
parente0d600ec190c64aff76cfcbd6009cffb927da166 (diff)
[ruby/prism] Reject pattern match with unexpected double splat inside array
`a => [-2**b]` should be SyntaxError Fixes: https://github.com/ruby/prism/issues/3381 https://github.com/ruby/prism/commit/ae8e83b389
Diffstat (limited to 'test')
-rw-r--r--test/prism/errors/pattern_match_with_unexpected_splat_inside_arraytxt14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/prism/errors/pattern_match_with_unexpected_splat_inside_arraytxt b/test/prism/errors/pattern_match_with_unexpected_splat_inside_arraytxt
new file mode 100644
index 0000000000..d19491e6bf
--- /dev/null
+++ b/test/prism/errors/pattern_match_with_unexpected_splat_inside_arraytxt
@@ -0,0 +1,14 @@
+a => [-2*b]
+ ^ expected a `]` to close the pattern expression
+ ^ unexpected '*', expecting end-of-input
+ ^ unexpected '*', ignoring it
+ ^ unexpected ']', expecting end-of-input
+ ^ unexpected ']', ignoring it
+
+a => [-2**b]
+ ^ expected a `]` to close the pattern expression
+ ^~ unexpected '**', expecting end-of-input
+ ^~ unexpected '**', ignoring it
+ ^ unexpected ']', expecting end-of-input
+ ^ unexpected ']', ignoring it
+