summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2025-01-08 16:12:25 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-01-08 17:12:19 +0900
commita4528f60e5219417d15da70771f871ed089896f0 (patch)
tree8a8065c018c39ed542d8765a44a8b32663147745
parent599a0601f60b0a3812b9ad1b95a8870cf2921d82 (diff)
Omit Psych_Unit_Tests if ostruct is not available
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12531
-rw-r--r--test/psych/test_yaml.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/psych/test_yaml.rb b/test/psych/test_yaml.rb
index 812a15dfcc..897a7c8935 100644
--- a/test/psych/test_yaml.rb
+++ b/test/psych/test_yaml.rb
@@ -2,7 +2,6 @@
# frozen_string_literal: true
require_relative 'helper'
-require 'ostruct'
# [ruby-core:01946]
module Psych_Tests
@@ -15,8 +14,14 @@ class Psych_Unit_Tests < Psych::TestCase
end
def test_y_method
- assert_raise(NoMethodError) do
- OpenStruct.new.y 1
+ begin
+ require 'ostruct'
+
+ assert_raise(NoMethodError) do
+ OpenStruct.new.y 1
+ end
+ rescue LoadError
+ omit("OpenStruct is not available")
end
end