mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
parent
8aa89a3084
commit
8241fb228b
2 changed files with 10 additions and 4 deletions
|
@ -587,14 +587,12 @@ MESSAGE
|
|||
if RUBY_VERSION >= '1.9'
|
||||
def html_escape(text)
|
||||
text = text.to_s
|
||||
text.gsub!(HTML_ESCAPE_REGEX, HTML_ESCAPE)
|
||||
text
|
||||
text.gsub(HTML_ESCAPE_REGEX, HTML_ESCAPE)
|
||||
end
|
||||
else
|
||||
def html_escape(text)
|
||||
text = text.to_s
|
||||
text.gsub!(HTML_ESCAPE_REGEX) {|s| HTML_ESCAPE[s]}
|
||||
text
|
||||
text.gsub(HTML_ESCAPE_REGEX) {|s| HTML_ESCAPE[s]}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -497,6 +497,14 @@ HAML
|
|||
assert_equal ""><&", Haml::Helpers.html_escape('"><&')
|
||||
end
|
||||
|
||||
def test_html_escape_should_work_on_frozen_strings
|
||||
begin
|
||||
assert Haml::Helpers.html_escape('foo'.freeze)
|
||||
rescue => e
|
||||
flunk e.message
|
||||
end
|
||||
end
|
||||
|
||||
def test_html_escape_encoding
|
||||
old_stderr, $stderr = $stderr, StringIO.new
|
||||
string = "\"><&\u00e9" # if you're curious, u00e9 is "LATIN SMALL LETTER E WITH ACUTE"
|
||||
|
|
Loading…
Add table
Reference in a new issue