From 4093598bf6eca8fce16fcb8695c4717063a5f6a0 Mon Sep 17 00:00:00 2001 From: shugo Date: Mon, 13 Aug 2012 04:17:00 +0000 Subject: * lib/erb.rb (ERB::Util.html_escape): use CGI.escape to escape single quotes. [ruby-core:47138] [Bug #6861] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/erb/test_erb.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/erb') diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb index 05d255623a..79c8d9c0e2 100644 --- a/test/erb/test_erb.rb +++ b/test/erb/test_erb.rb @@ -37,6 +37,16 @@ class TestERB < Test::Unit::TestCase } assert_match(/\Atest filename:1\b/, e.backtrace[0]) end + + def test_html_escape + # TODO: ' should be chaged to ' + assert_equal(" !"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", + ERB::Util.html_escape(" !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~")) + + assert_equal("", ERB::Util.html_escape("")) + assert_equal("abc", ERB::Util.html_escape("abc")) + assert_equal("<<", ERB::Util.html_escape("<<")) + end end class TestERBCore < Test::Unit::TestCase -- cgit v1.2.3