diff options
author | Nobuyoshi Nakada <[email protected]> | 2025-05-02 15:05:20 +0900 |
---|---|---|
committer | git <[email protected]> | 2025-05-02 06:27:11 +0000 |
commit | 430789dec4df4c8294c135b6eff3cf2e6d78db76 (patch) | |
tree | 18fea3834799963251be28e4c099c855ce589295 /test | |
parent | d2a0e98c78851c5111402e11bacd0468a1917fba (diff) |
[ruby/psych] Ensure to remove the test constants
https://github.com/ruby/psych/commit/dd3685aa67
Diffstat (limited to 'test')
-rw-r--r-- | test/psych/test_yaml.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/psych/test_yaml.rb b/test/psych/test_yaml.rb index 89bd3130e3..134c346c90 100644 --- a/test/psych/test_yaml.rb +++ b/test/psych/test_yaml.rb @@ -1042,7 +1042,6 @@ EOY end def test_ruby_struct - Struct.send(:remove_const, :MyBookStruct) if Struct.const_defined?(:MyBookStruct) # Ruby structures book_struct = Struct::new( "MyBookStruct", :author, :title, :year, :isbn ) assert_to_yaml( @@ -1074,11 +1073,12 @@ EOY c: 123 EOY + ensure + Struct.__send__(:remove_const, :MyBookStruct) if book_struct end def test_ruby_data omit "Data requires ruby >= 3.2" if RUBY_VERSION < "3.2" - Object.remove_const :MyBookData if Object.const_defined?(:MyBookData) # Ruby Data value objects book_class = Data.define(:author, :title, :year, :isbn) Object.const_set(:MyBookData, book_class) @@ -1112,6 +1112,8 @@ EOY c: 123 EOY + ensure + Object.__send__(:remove_const, :MyBookData) if book_class end def test_ruby_rational |