summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_zjit.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb
index ca6293ce04..8115a60166 100644
--- a/test/ruby/test_zjit.rb
+++ b/test/ruby/test_zjit.rb
@@ -887,6 +887,38 @@ class TestZJIT < Test::Unit::TestCase
}
end
+ def test_attr_reader
+ assert_compiles '[4, 4]', %q{
+ class C
+ attr_reader :foo
+
+ def initialize
+ @foo = 4
+ end
+ end
+
+ def test(c) = c.foo
+ c = C.new
+ [test(c), test(c)]
+ }, call_threshold: 2, insns: [:opt_send_without_block]
+ end
+
+ def test_attr_accessor
+ assert_compiles '[4, 4]', %q{
+ class C
+ attr_accessor :foo
+
+ def initialize
+ @foo = 4
+ end
+ end
+
+ def test(c) = c.foo
+ c = C.new
+ [test(c), test(c)]
+ }, call_threshold: 2, insns: [:opt_send_without_block]
+ end
+
def test_uncached_getconstant_path
assert_compiles RUBY_COPYRIGHT.dump, %q{
def test = RUBY_COPYRIGHT