rubychan / coderay

Fast and easy syntax highlighting for selected languages, written in Ruby.
http://coderay.rubychan.de/
Other
846 stars 115 forks source link

Get tests running with frozen string literals. #211

Closed pat closed 7 years ago

pat commented 7 years ago

These changes ensure that all string literals can be frozen (as per the optional feature in MRI 2.3 and onwards).

I would recommend adding the following to your .travis.yml file to ensure regressions aren't introduced:

before_script:
- if (ruby -e "exit RUBY_VERSION.to_f >= 2.4"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT

This will add the flag when the tests are run on MRI 2.4 or newer (while the feature was introduced in 2.3, it doesn't seem to work reliably until 2.4). Note that to get the test suite passing in that situation, you'll need the latest test-unit release (3.2.5), because that's now also frozen-string-literal compatible.

korny commented 7 years ago

Thank you!

pat commented 7 years ago

No worries, thanks for merging :)

mvz commented 7 years ago

Specs on 2.4 fail due to RedCloth not supporting immutable strings.

korny commented 7 years ago

Will be fixed in the next version; sorry for not releasing sooner.

mvz commented 6 years ago

Support for immutable strings has been merged in RedCloth, so that's one step toward making the specs succeed on 2.4: https://github.com/jgarber/redcloth/pull/38