summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorJemma Issroff <jemmaissroff@gmail.com>2023-10-25 12:40:30 -0300
committerJemma Issroff <jemmaissroff@gmail.com>2023-10-26 07:15:35 -0300
commit68a81b44e3907f2ceb4dc3864e65b565c42d1c63 (patch)
treee6a2ba88f327c1576a14ab6584d0fff619583e6e /test/ruby
parente28a03303540d9554fe669a67b329d2414d0456c (diff)
[PRISM] Implement compilation for CallOrWriteNode
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_compile_prism.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index ed37995929..8a4e03910e 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -633,6 +633,42 @@ module Prism
)
end
+ def test_CallOrWriteNode
+ test_prism_eval(<<-CODE
+ def Object.test_call_or_write_node; end;
+ def Object.test_call_or_write_node=(val)
+ val
+ end
+ Object.test_call_or_write_node ||= 1
+ CODE
+ )
+
+ test_prism_eval(<<-CODE
+ def Object.test_call_or_write_node
+ "str"
+ end
+ Object.test_call_or_write_node ||= 1
+ CODE
+ )
+
+ test_prism_eval(<<-CODE
+ def self.test_call_or_write_node; end;
+ def self.test_call_or_write_node=(val)
+ val
+ end
+ self.test_call_or_write_node ||= 1
+ CODE
+ )
+
+ test_prism_eval(<<-CODE
+ def self.test_call_or_write_node
+ "str"
+ end
+ self.test_call_or_write_node ||= 1
+ CODE
+ )
+ end
+
def test_KeywordHashNode
assert_prism_eval("[a: [:b, :c]]")
end