rspec testsuite fails with ruby4.0.0dev 2025-11-24

未关闭
#63 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
ruby
领域
testing-qa

调研方向

使用所引用的 Ruby 4.0.0dev 更改运行 RSpec 套件,并检查 spec/compliance_spec.rb、spec/implicit_conversion_spec.rb 和 spec/compliance/identifiers.json。跟踪 JSON::GeneratorError 报告的格式错误的 UTF-8 数据,然后验证完整的测试套件能够加载并通过,且不移除 identifiers fixture。

由索引模型根据 Issue 内容生成。

描述

Beginning with this ruby4.0.0dev commit:
https://github.com/ruby/ruby/commit/c7a84ae0bb8c6dab3463076d7e5ca9b6f89880f4

(Or for ruby/json: beginning with this commit:
https://github.com/ruby/json/commit/4f4551f993bf1642eb8e0a18152306c5b25b18ea
)

jmespath git head ( https://github.com/jmespath/jmespath.rb/commit/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 )
rspec testsuite fails like:

An error occurred while loading ./spec/compliance_spec.rb.
Failure/Error:
          describe("Given #{scenario['given'].to_json}") do
            scenario['cases'].each do |test_case|
              if test_case['error']
  
                it "the expression #{test_case['expression'].inspect} raises a #{test_case['error']} error" do
                  error_class = case test_case['error']
                                when 'runtime' then JMESPath::Errors::RuntimeError
                                when 'syntax' then JMESPath::Errors::SyntaxError
                                when 'invalid-type' then JMESPath::Errors::InvalidTypeError
                                when 'invalid-value' then JMESPath::Errors::InvalidValueError

JSON::GeneratorError:
  source sequence is illegal/malformed utf-8
# ./spec/compliance_spec.rb:12:in 'JSON::Ext::Generator::GeneratorMethods::Hash#to_json'
# ./spec/compliance_spec.rb:12:in 'block (4 levels) in <top (required)>'
# ./spec/compliance_spec.rb:11:in 'Array#each'
# ./spec/compliance_spec.rb:11:in 'block (3 levels) in <top (required)>'
# ./spec/compliance_spec.rb:10:in 'block (2 levels) in <top (required)>'
# ./spec/compliance_spec.rb:5:in 'Array#each'
# ./spec/compliance_spec.rb:5:in 'block in <top (required)>'
# ./spec/compliance_spec.rb:4:in '<top (required)>'

An error occurred while loading ./spec/implicit_conversion_spec.rb.
Failure/Error:
              describe("Given #{scenario['given'].to_json}") do
                scenario['cases'].each do |test_case|
                  next if test_case['error']
                  it "searching #{test_case['expression'].inspect} returns #{test_case['result'].to_json}" do
                    result = JMESPath.search(test_case['expression'], Wrapper.wrap(scenario['given']))
  
                    expect(JMESPath::Util.as_json(result)).to eq(test_case['result'])
                  end
                end
              end

JSON::GeneratorError:
  source sequence is illegal/malformed utf-8
# ./spec/implicit_conversion_spec.rb:65:in 'JSON::Ext::Generator::GeneratorMethods::Hash#to_json'
# ./spec/implicit_conversion_spec.rb:65:in 'block (5 levels) in <module:JMESPath>'
# ./spec/implicit_conversion_spec.rb:64:in 'Array#each'
# ./spec/implicit_conversion_spec.rb:64:in 'block (4 levels) in <module:JMESPath>'
# ./spec/implicit_conversion_spec.rb:63:in 'block (3 levels) in <module:JMESPath>'
# ./spec/implicit_conversion_spec.rb:58:in 'Array#each'
# ./spec/implicit_conversion_spec.rb:58:in 'block (2 levels) in <module:JMESPath>'
# ./spec/implicit_conversion_spec.rb:57:in 'block in <module:JMESPath>'
# ./spec/implicit_conversion_spec.rb:37:in '<module:JMESPath>'
# ./spec/implicit_conversion_spec.rb:36:in '<top (required)>'


Finished in 0.00007 seconds (files took 0.5614 seconds to load)
0 examples, 0 failures, 2 errors occurred outside of examples

spec/compliance/identifiers.json is failing (if I remove this json file, rspec testsuite passes).

主要语言
Ruby
星标
167
派生
45
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

jmespath/jmespath.rb 的其他 Issue

查看 jmespath/jmespath.rb 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。