-
-
Notifications
You must be signed in to change notification settings - Fork 571
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
Enable frozen string literal #1039
Changes from all commits
83e5654
47f79fd
e5e2b84
37ae2e4
5e1b014
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,10 @@ def test_engine_reflects_defaults | |
Haml::Options.defaults.replace(defaults) | ||
end | ||
|
||
# This test is here due to https://github.com/haml/haml/issues/972 | ||
# where we used to trust in the #inspect of `true` and `false` to return | ||
# "true" and "false". This tests isolates and executes a whole ruby interpreter | ||
# to catch the problem. | ||
def test_engine_inspect_monkeypatch | ||
Tempfile.open(['haml-test', '.rb']) do |f| | ||
f.puts <<-HAML | ||
|
@@ -37,9 +41,15 @@ def inspect | |
print Haml::Engine.new('%div{ foo: true, bar: false }').render | ||
HAML | ||
f.close | ||
out = IO.popen([RbConfig.ruby, f.path], &:read) | ||
out = IO.popen([RbConfig.ruby, '-W0', f.path], &:read) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a documentation note here on why the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here the I attempted to set ruby interpreter warning level to 0 (=silence), with hopes that jruby warning wouldn't be printed out. I see that you've already merged the PR, I guess, I can leave it as is. |
||
assert_equal true, $?.success? | ||
assert_equal "<div foo></div>\n", out | ||
# JRuby can sometimes print warnings that are printed to STDOUT | ||
# which can cause a 'polluted' output. Here, instead of looking | ||
# for a perfectly clean output, we ensure the expected output | ||
# is included – but not that in this invocation-style that it's | ||
# perfectly clean. An error that truly broke rendering would | ||
# be caught by many other lines | ||
assert out.include?("<div foo></div>\n") | ||
end | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,7 +160,7 @@ def test_silent_end_with_stuff | |
b | ||
a | ||
HTML | ||
- str = "abcde" | ||
- str = +"abcde" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow, I had no idea about this feature... it took me some serious digging to learn what it even was. Great work! |
||
- if true | ||
= str.slice!(-1).chr | ||
- end until str.empty? | ||
|
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'd be curious if there are any performance issues here...?