summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Dalessio <mike.dalessio@gmail.com>2023-08-30 13:09:02 -0400
committergit <svn-admin@ruby-lang.org>2023-08-30 20:46:09 +0000
commit6beaf010a447ce9fb35c85f9fb2f41685e2114ba (patch)
tree30fa9a385c566e2c4bfc8c6db59a74670501eac5 /test
parentf80582cda8fb0d994db0c1cdf1c282f3a049485c (diff)
[ruby/yarp] fix: binary CallNode with out-of-order arg and receiver
The snippet added in this commit previously resulted in a CallNode with inverted start and end locations: > AssocNode(15...13)( > CallNode(15...13)( StringNode(15...17)((15...16), (16...16), (16...17), ""), nil, (12...13), nil, ArgumentsNode(12...13)([MissingNode(12...13)()]), nil, nil, 0, "/" ), MissingNode(13...13)(), (13...13) ), which failed an assertion during serialization. After this change, it looks better: > AssocNode(12...13)( > CallNode(12...17)( StringNode(15...17)((15...16), (16...16), (16...17), ""), nil, (12...13), nil, ArgumentsNode(12...13)([MissingNode(12...13)()]), nil, nil, 0, "/" ), MissingNode(13...13)(), (13...13) ), Found by the fuzzer. https://github.com/ruby/yarp/commit/040aa63ad6
Diffstat (limited to 'test')
-rw-r--r--test/yarp/fuzzer_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/yarp/fuzzer_test.rb b/test/yarp/fuzzer_test.rb
index d75d1422f0..4d7a0af8e7 100644
--- a/test/yarp/fuzzer_test.rb
+++ b/test/yarp/fuzzer_test.rb
@@ -28,5 +28,10 @@ module YARP
A
B
EOF
+ snippet "create a binary call node with arg before receiver", <<~EOF
+ <<-A.g/{/
+ A
+ /, ""\\
+ EOF
end
end