summaryrefslogtreecommitdiff
path: root/test/ripper/test_sexp.rb
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/ripper/test_sexp.rb
parent2f916812a9b818b432ee7c299e021ec62d4727fb (diff)
[Bug #19175] p_rest should be `assignable'
It should also check for duplicate names.
Diffstat (limited to 'test/ripper/test_sexp.rb')
-rw-r--r--test/ripper/test_sexp.rb26
1 files changed, 21 insertions, 5 deletions
diff --git a/test/ripper/test_sexp.rb b/test/ripper/test_sexp.rb
index 9faeaba782..b7cabdb8b0 100644
--- a/test/ripper/test_sexp.rb
+++ b/test/ripper/test_sexp.rb
@@ -175,7 +175,7 @@ eot
[:aryptn,
nil,
[[:var_field, [:@ident, "a", [1, 11]]]],
- [:var_field, nil],
+ nil,
nil],
[[:void_stmt]],
nil]],
@@ -229,7 +229,7 @@ eot
[__LINE__, %q{ case 0; in *; end }] =>
[:case,
[:@int, "0", [1, 5]],
- [:in, [:aryptn, nil, nil, [:var_field, nil], nil], [[:void_stmt]], nil]],
+ [:in, [:aryptn, nil, nil, nil, nil], [[:void_stmt]], nil]],
[__LINE__, %q{ case 0; in *,a; end }] =>
[:case,
@@ -238,7 +238,7 @@ eot
[:aryptn,
nil,
nil,
- [:var_field, nil],
+ nil,
[[:var_field, [:@ident, "a", [1, 13]]]]],
[[:void_stmt]],
nil]],
@@ -407,6 +407,14 @@ eot
[[:void_stmt]],
nil]],
+ [__LINE__, %q{ case 0; in [a,]; end }] =>
+ [:case,
+ [:@int, "0", [1, 5]],
+ [:in,
+ [:aryptn, nil, [[:var_field, [:@ident, "a", [1, 12]]]], nil, nil],
+ [[:void_stmt]],
+ nil]],
+
[__LINE__, %q{ case 0; in []; end }] =>
[:case,
[:@int, "0", [1, 5]],
@@ -418,9 +426,9 @@ eot
[:in,
[:fndptn,
nil,
- [:var_field, nil],
+ nil,
[[:var_field, [:@ident, "a", [1, 9]]]],
- [:var_field, nil]],
+ nil],
nil,
nil]],
@@ -486,6 +494,14 @@ eot
[:begin, [:binary, [:@int, "0", [1, 13]], :+, [:@int, "0", [1, 15]]]],
[[:void_stmt]],
nil]],
+
+ [__LINE__, %q{ case 0; in [*a]; a; end } ] =>
+ [:case,
+ [:@int, "0", [1, 5]],
+ [:in,
+ [:aryptn, nil, nil, [:var_field, [:@ident, "a", [1, 13]]], nil],
+ [[:var_ref, [:@ident, "a", [1, 17]]]],
+ nil]],
}
pattern_matching_data.each do |(i, src), expected|
define_method(:"test_pattern_matching_#{i}") do