summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/.excludes-zjit/TestERBCore.rb1
-rw-r--r--test/.excludes-zjit/TestERBCoreWOStrScan.rb1
-rw-r--r--test/ruby/test_zjit.rb31
3 files changed, 31 insertions, 2 deletions
diff --git a/test/.excludes-zjit/TestERBCore.rb b/test/.excludes-zjit/TestERBCore.rb
deleted file mode 100644
index 9ab398de6f..0000000000
--- a/test/.excludes-zjit/TestERBCore.rb
+++ /dev/null
@@ -1 +0,0 @@
-exclude(:test_invalid_trim_mode, 'Test fails with ZJIT')
diff --git a/test/.excludes-zjit/TestERBCoreWOStrScan.rb b/test/.excludes-zjit/TestERBCoreWOStrScan.rb
deleted file mode 100644
index 9ab398de6f..0000000000
--- a/test/.excludes-zjit/TestERBCoreWOStrScan.rb
+++ /dev/null
@@ -1 +0,0 @@
-exclude(:test_invalid_trim_mode, 'Test fails with ZJIT')
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb
index 9bfe2c0c00..280a7503d4 100644
--- a/test/ruby/test_zjit.rb
+++ b/test/ruby/test_zjit.rb
@@ -766,6 +766,37 @@ class TestZJIT < Test::Unit::TestCase
}, insns: [:opt_ge], call_threshold: 2
end
+ def test_opt_new_does_not_push_frame
+ assert_compiles 'nil', %q{
+ class Foo
+ attr_reader :backtrace
+
+ def initialize
+ @backtrace = caller
+ end
+ end
+ def test = Foo.new
+
+ foo = test
+ foo.backtrace.find do |frame|
+ frame.include?('Class#new')
+ end
+ }, insns: [:opt_new]
+ end
+
+ def test_opt_new_with_redefinition
+ assert_compiles '"foo"', %q{
+ class Foo
+ def self.new = "foo"
+
+ def initialize = raise("unreachable")
+ end
+ def test = Foo.new
+
+ test
+ }, insns: [:opt_new]
+ end
+
def test_new_hash_empty
assert_compiles '{}', %q{
def test = {}