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

YARD fails to recognize empty symbol (:"") on Ruby 2.6.3, which causes build failures #1243

Closed
skalee opened this issue May 9, 2019 · 2 comments

Comments

@skalee
Copy link
Contributor

skalee commented May 9, 2019

Something has changed in Ruby 2.6.3. In the result, two tests fail.

Steps to reproduce

  1. Switch to Ruby 2.6.3.
  2. Run bundle exec rspec or bundle exec rake.

Actual Output

RSpec Failures
  1) YARD::Handlers::Ruby::ConstantHandler documents block for Struct.new if present
     Failure/Error: expect(obj.constants[1].value).to eq ':""'

       expected: ":\"\""
            got: ":\"\\n\""

       (compared using ==)
     # ./spec/handlers/constant_handler_spec.rb:39:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:127:in `block (2 levels) in <top (required)>'

  2) YARD::Templates::Helpers::MethodHelper#format_constant displays correctly constant values which are quoted symbols
     Failure/Error: expect(format_constant(foo)).to eq ":&quot;&quot;"

       expected: ":&quot;&quot;"
            got: ":&quot;\\n&quot;"

       (compared using ==)
     # ./spec/templates/helpers/method_helper_spec.rb:102:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:127:in `block (2 levels) in <top (required)>'

Expected Output

All tests should pass.

Possible causes

According to release notes, not much has changed:

This release adds support for New Japanese Era “令和” (Reiwa). It updates the Unicode version to 12.1 beta and updates the date library.

Full changelog:

Main suspect:

Secondary suspect:


I have read the Contributing Guide.

@skalee skalee changed the title Build failures on Ruby 2.6.3 YARD fails to recognize symbol :'' on Ruby 2.6.3, which causes build failures May 9, 2019
@skalee skalee changed the title YARD fails to recognize symbol :'' on Ruby 2.6.3, which causes build failures YARD fails to recognize symbol :"" on Ruby 2.6.3, which causes build failures May 9, 2019
@skalee skalee changed the title YARD fails to recognize symbol :"" on Ruby 2.6.3, which causes build failures YARD fails to recognize empty symbol (:"") on Ruby 2.6.3, which causes build failures May 9, 2019
@skalee
Copy link
Contributor Author

skalee commented May 9, 2019

More details:

In ./spec/handlers/constant_handler_spec.rb:38, source range of s(:string_content, ) which represents the empty string in symbol definition :'' is 417..417, whereas it should be 416..415. Note that both boundaries are incorrect.

Non-empty quoted symbols (e.g. :'42') are recognized as intended.

@lsegal
Copy link
Owner

lsegal commented Jun 28, 2019

This was fixed in #1256. Thanks for reporting!

@lsegal lsegal closed this as completed Jun 28, 2019
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

No branches or pull requests

2 participants