summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRandy Stauner <randy@r4s6.net>2026-02-10 10:48:17 -0700
committerGitHub <noreply@github.com>2026-02-10 09:48:17 -0800
commit09ae95332f34791c68c841f8ad41b3f3ff9e8609 (patch)
treee01df05a446c6ce56317199479b25442c2a796dd /test
parentacacbec35943a1fd3dd58af54d78fb878d80aae4 (diff)
ZJIT: Avoid runtime exceptions from RubyVM::ZJIT.stats_string (#16134)
Before this it would raise if zjit wasn't enabled and raise a different exception if zjit was but extended stats were not (_some_ stats are available).
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_zjit.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb
index 333e34e927..ff7c167327 100644
--- a/test/ruby/test_zjit.rb
+++ b/test/ruby/test_zjit.rb
@@ -27,6 +27,18 @@ class TestZJIT < Test::Unit::TestCase
RUBY
end
+ def test_stats_string_no_zjit
+ assert_runs 'nil', <<~RUBY, zjit: false
+ RubyVM::ZJIT.stats_string
+ RUBY
+ assert_runs 'true', <<~RUBY, stats: false
+ RubyVM::ZJIT.stats_string.is_a?(String)
+ RUBY
+ assert_runs 'true', <<~RUBY, stats: true
+ RubyVM::ZJIT.stats_string.is_a?(String)
+ RUBY
+ end
+
def test_stats_quiet
# Test that --zjit-stats-quiet collects stats but doesn't print them
script = <<~RUBY