summaryrefslogtreecommitdiff
path: root/test/erb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-11-02 22:28:45 -0700
committergit <svn-admin@ruby-lang.org>2022-11-04 07:07:23 +0000
commitdc5d06e9b145f7d5f8c5f7c3757b43f2d68833fd (patch)
treeb52226f5156906a37dab0970c4d184e19b2b830f /test/erb
parentb6d7e98f2540500f072c5cc0f136cae69f80055c (diff)
downloadruby-dc5d06e9b145f7d5f8c5f7c3757b43f2d68833fd.tar.gz
[ruby/erb] Copy CGI.escapeHTML to ERB::Util.html_escape
https://github.com/ruby/erb/commit/ac9b219fa9
Diffstat (limited to 'test/erb')
-rw-r--r--test/erb/test_erb.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb
index 424ddae87e..1db0e55f8a 100644
--- a/test/erb/test_erb.rb
+++ b/test/erb/test_erb.rb
@@ -73,11 +73,24 @@ class TestERB < Test::Unit::TestCase
assert_equal("", ERB::Util.html_escape(""))
assert_equal("abc", ERB::Util.html_escape("abc"))
assert_equal("&lt;&lt;", ERB::Util.html_escape("<\<"))
+ assert_equal("&#39;&amp;&quot;&gt;&lt;", ERB::Util.html_escape("'&\"><"))
assert_equal("", ERB::Util.html_escape(nil))
assert_equal("123", ERB::Util.html_escape(123))
end
+ def test_html_escape_to_s
+ object = Object.new
+ def object.to_s
+ "object"
+ end
+ assert_equal("object", ERB::Util.html_escape(object))
+ end
+
+ def test_html_escape_extension
+ assert_nil(ERB::Util.method(:html_escape).source_location)
+ end if RUBY_ENGINE == 'ruby'
+
def test_concurrent_default_binding
# This test randomly fails with JRuby -- NameError: undefined local variable or method `template2'
pend if RUBY_ENGINE == 'jruby'