-
Notifications
You must be signed in to change notification settings - Fork 2
Improve frozen-string-literals compatibility. #6
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
Conversation
|
Interesting. Before I merge, do you think you can write a failing test for this? |
|
I do think |
|
Can't think of any way to write a test for this thus far… though just to be clear: without my patch, if you run the tests on MRI 2.4.x with Generally in my patches I've been recommending people add the following to their Travis CI configuration (provided they're also testing against a 2.4 release): before_script:
- if (ruby -e "exit RUBY_VERSION.to_f >= 2.4"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPTBut from what I can see, Travis isn't being used for this repo, so that's not so useful here. |
|
I'm very happy to switch |
|
You also need to update CHANGELOG, please. Do you have time to add CI to this project in a separate PR? I inherited syntax as nobody wanted to maintain it, could use some help and this is a good opportunity. |
|
I'm A-OK with "".dup. I'll merge with CHANGELOG and call it a day. Want to help out with a release? |
|
Changelog is updated, and about to create another PR with a working Travis configuration. |
|
Now that the Travis-CI config is merged, rebase this and add the configuration w/ a test that will otherwise fail, ie. with |
1d32ce4 to
01d27cf
Compare
|
Rebased with |
.travis.yml
Outdated
| - jruby-19mode | ||
| - jruby-9.1.12.0 | ||
| sudo: false | ||
| before_script: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe this export propagates further actually.
Can we instead add a matrix include config with ruby 2.4.1 that runs this explicitly instead of a conditional? You can set an env key with a value explicitly in travis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The export does work (just confirmed with a test branch on my fork: https://travis-ci.org/pat/syntax/jobs/249047431), but will switch over to the other syntax anyway.
Instead, let's make use of a more detailed build matrix.
|
Merged. Thank you. Feel free to cut a release. |
Some changes to ensure
syntaxis happy to run when the--enable-frozen-string-literalflag is in place viaRUBYOPTwhen using MRI 2.4. The tests passed for me locally both before and after these changes.I realise this is a bit of a surprising patch for a library that's built with MRI 1.9, but I've followed the path of dependencies from rspec to cucumber to here, patching as I go :)
Also: I've opted for
"".dupinstead ofString.new, because the latter has an ASCII encoding, whereasString.new("")respects the argument's encoding (UTF-8 in recent MRI releases). Happy to tweak things if you've a preferred syntax.