aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_econv.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_econv.rb')
-rw-r--r--test/ruby/test_econv.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb
index c458371ad4..49ba2ae9d3 100644
--- a/test/ruby/test_econv.rb
+++ b/test/ruby/test_econv.rb
@@ -727,14 +727,30 @@ class TestEncodingConverter < Test::Unit::TestCase
assert_equal("&", ec.convert("&"))
end
- def test_html_escape
+ def test_html_escape_text
ec = Encoding::Converter.new("", "amp-escaped")
assert_equal('&amp;<>"', ec.convert("&<>\""))
+ assert_equal('', ec.finish)
ec = Encoding::Converter.new("", "html-text-escaped")
assert_equal('&amp;&lt;&gt;"', ec.convert("&<>\""))
+ assert_equal('', ec.finish)
+ end
+
+ def test_html_escape_attr
+ ec = Encoding::Converter.new("", "html-attr-escaped")
+ assert_equal('""', ec.finish)
+
+ ec = Encoding::Converter.new("", "html-attr-escaped")
+ assert_equal('', ec.convert(""))
+ assert_equal('""', ec.finish)
+
+ ec = Encoding::Converter.new("", "html-attr-escaped")
+ assert_equal('"&quot;', ec.convert('"'))
+ assert_equal('"', ec.finish)
ec = Encoding::Converter.new("", "html-attr-escaped")
- assert_equal('&amp;&lt;&gt;&quot;', ec.convert("&<>\""))
+ assert_equal('"&amp;&lt;&gt;&quot;', ec.convert("&<>\""))
+ assert_equal('"', ec.finish)
end
end