Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Fix failures with Ruby 3.5-dev #957

Merged
merged 2 commits into from
Feb 8, 2025

Conversation

Watson1978
Copy link
Collaborator

@Watson1978 Watson1978 commented Feb 8, 2025

Recently Ruby HEAD has some changes in JSON and it causes failures in tests.
Ref. https://github.com/ohler55/oj/actions/runs/13188779428

1. json_ext_parser_test.rb

Since ruby/ruby@599fbeaffa, it causes failure in test_allocate

=========================================================================================================================================================================================================================================
Failure: test_allocate(JSONExtParserTest):
  [ruby-core:35079].
  <TypeError> exception was expected but none was thrown.
test/json_gem/json_ext_parser_test.rb:14:in 'JSONExtParserTest#test_allocate'
     11:   if defined?(JSON::Ext::Parser)
     12:     def test_allocate
     13:       parser = JSON::Ext::Parser.new("{}")
  => 14:       assert_raise(TypeError, '[ruby-core:35079]') do
     15:         parser.__send__(:initialize, "{}")
     16:       end
     17:       parser = JSON::Ext::Parser.allocate

2. json_generator_test.rb

Since ruby/ruby@89e316ad06, it causes failure in test_fast_state/test_pretty_state/test_safe_state

=========================================================================================================================================================================================================================================
Failure: test_fast_state(JSONGeneratorTest)
test/json_gem/json_generator_test.rb:191:in 'JSONGeneratorTest#test_fast_state'
     188:     actual.delete(:escape_slash)
     189:     actual.delete(:strict)
     190:     actual.delete(:script_safe)
  => 191:     assert_equal({
     192:       :allow_nan             => false,
     193:       :array_nl              => "",
     194:       :ascii_only            => false,
<[[:allow_nan, false],
 [:array_nl, ""],
 [:ascii_only, false],
 [:buffer_initial_length, 1024],
 [:depth, 0],
 [:indent, ""],
 [:max_nesting, 0],
 [:object_nl, ""],
 [:space, ""],
 [:space_before, ""]]> expected but was
<[[:allow_nan, false],
 [:array_nl, ""],
 [:as_json, false],
 [:ascii_only, false],
 [:buffer_initial_length, 1024],
 [:depth, 0],
 [:indent, ""],
 [:max_nesting, 0],
 [:object_nl, ""],
 [:space, ""],
 [:space_before, ""]]>

diff:
  [[:allow_nan, false],
   [:array_nl, ""],
+  [:as_json, false],
   [:ascii_only, false],
   [:buffer_initial_length, 1024],
   [:depth, 0],
   [:indent, ""],
   [:max_nesting, 0],
   [:object_nl, ""],
   [:space, ""],
   [:space_before, ""]]
=========================================================================================================================================================================================================================================

Since ruby/ruby@599fbeaffa, it causes failure in test_allocate

```
=========================================================================================================================================================================================================================================
Failure: test_allocate(JSONExtParserTest):
  [ruby-core:35079].
  <TypeError> exception was expected but none was thrown.
test/json_gem/json_ext_parser_test.rb:14:in 'JSONExtParserTest#test_allocate'
     11:   if defined?(JSON::Ext::Parser)
     12:     def test_allocate
     13:       parser = JSON::Ext::Parser.new("{}")
  => 14:       assert_raise(TypeError, '[ruby-core:35079]') do
     15:         parser.__send__(:initialize, "{}")
     16:       end
     17:       parser = JSON::Ext::Parser.allocate
```
Since ruby/ruby@89e316ad06,  it causes failure in test_fast_state/test_pretty_state/test_safe_state
```
=========================================================================================================================================================================================================================================
Failure: test_fast_state(JSONGeneratorTest)
test/json_gem/json_generator_test.rb:191:in 'JSONGeneratorTest#test_fast_state'
     188:     actual.delete(:escape_slash)
     189:     actual.delete(:strict)
     190:     actual.delete(:script_safe)
  => 191:     assert_equal({
     192:       :allow_nan             => false,
     193:       :array_nl              => "",
     194:       :ascii_only            => false,
<[[:allow_nan, false],
 [:array_nl, ""],
 [:ascii_only, false],
 [:buffer_initial_length, 1024],
 [:depth, 0],
 [:indent, ""],
 [:max_nesting, 0],
 [:object_nl, ""],
 [:space, ""],
 [:space_before, ""]]> expected but was
<[[:allow_nan, false],
 [:array_nl, ""],
 [:as_json, false],
 [:ascii_only, false],
 [:buffer_initial_length, 1024],
 [:depth, 0],
 [:indent, ""],
 [:max_nesting, 0],
 [:object_nl, ""],
 [:space, ""],
 [:space_before, ""]]>

diff:
  [[:allow_nan, false],
   [:array_nl, ""],
+  [:as_json, false],
   [:ascii_only, false],
   [:buffer_initial_length, 1024],
   [:depth, 0],
   [:indent, ""],
   [:max_nesting, 0],
   [:object_nl, ""],
   [:space, ""],
   [:space_before, ""]]
=========================================================================================================================================================================================================================================
```
@ohler55
Copy link
Owner

ohler55 commented Feb 8, 2025

You are awesome. Thank you.

@ohler55 ohler55 merged commit 5b65384 into ohler55:develop Feb 8, 2025
52 checks passed
@Watson1978 Watson1978 deleted the ci/fix-failure-with-ruby-3.5 branch February 9, 2025 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants