summaryrefslogtreecommitdiff
path: root/test/ruby/test_econv.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-05 21:29:12 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-05 21:29:12 +0000
commita10a5ddaacb05368cee3beec82af47043aec6667 (patch)
tree6b90181b6b7e94ffa5b641134af629a41080d8e9 /test/ruby/test_econv.rb
parentfb9c53dea50fbbf7d789f0cac004a00c6d125022 (diff)
* enc/trans/escape.trans: new file.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_econv.rb')
-rw-r--r--test/ruby/test_econv.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb
index 0a774c4a7a..be4917ddf7 100644
--- a/test/ruby/test_econv.rb
+++ b/test/ruby/test_econv.rb
@@ -692,5 +692,19 @@ class TestEncodingConverter < Test::Unit::TestCase
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1", Encoding::Converter::UNDEF_HEX_CHARREF)
assert_equal("&#x4EA4;&#x63DB;&#x6CD5;&#x5247;: n\xD7m=m\xD7n".force_encoding("ISO-8859-1"),
ec.convert("\xB8\xF2\xB4\xB9\xCB\xA1\xC2\xA7: n\xA1\xDFm=m\xA1\xDFn"))
+
+ ec = Encoding::Converter.new("UTF-8", "US-ASCII", Encoding::Converter::UNDEF_HEX_CHARREF)
+ assert_equal("&", ec.convert("&"))
+ end
+
+ def test_html_escape
+ ec = Encoding::Converter.new("", "amp-escaped")
+ assert_equal('&amp;<>"', ec.convert("&<>\""))
+
+ ec = Encoding::Converter.new("", "html-text-escaped")
+ assert_equal('&amp;&lt;&gt;"', ec.convert("&<>\""))
+
+ ec = Encoding::Converter.new("", "html-attr-escaped")
+ assert_equal('&amp;&lt;&gt;&quot;', ec.convert("&<>\""))
end
end