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

Fix RubyLex's heredoc_with_hembexpr test to avoid ripper tokenizing i… #558

Merged
merged 1 commit into from
Apr 7, 2023

Conversation

tompng
Copy link
Member

@tompng tompng commented Apr 6, 2023

Fix test_heredoc_with_embexpr because the expected result was wrong.
We also have to avoid ripper's bug https://bugs.ruby-lang.org/issues/19563 in test cases because I want this test to be executed in all supported ruby version.

require 'ripper'
code = [
  %q(<<A+%W[#{<<B),
  %q(#{<<C+%W[),
  %q(a),
  %q(C),
  %q(a), # if this line is an empty string `%(),` then `Ripper.tokenize(code).join == code` returns false
  %q(]}),
  %q(}),
  %q(A),
  %q(B),
  %q(}),
  %q(]),
  %q()
].join("\n")
puts RUBY_VERSION
p Ripper.tokenize(code).join == code #=> true in ruby 2.7~3.2

@tompng tompng merged commit f68e891 into ruby:master Apr 7, 2023
@tompng tompng deleted the fix_heredoc_prompt_test branch April 7, 2023 11:03
matzbot pushed a commit to ruby/ruby that referenced this pull request Apr 7, 2023
nobu added a commit to ruby/ruby that referenced this pull request Apr 7, 2023
So that newlines across a here-doc terminator will be separated
tokens.

Cf. ruby/irb#558
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants