diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-06 03:20:51 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-06 03:20:51 +0000 |
commit | 091171a28654801c533166d1819ec7e1705a53ac (patch) | |
tree | 61a90685b37aff6938b8ccbdf990d4e7345df224 /test | |
parent | d90ab4c09b7f99c28fe3f475e0b085f5175ef713 (diff) | |
download | ruby-091171a28654801c533166d1819ec7e1705a53ac.tar.gz |
* enc/trans/escape.trans (escape_html_attr_init): new function.
(fun_so_escape_html_attr): new function.
(escape_html_attr_finish): new function.
(rb_escape_html_attr): use them to quote the converted result.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_econv.rb | 20 |
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('&<>"', ec.convert("&<>\"")) + assert_equal('', ec.finish) ec = Encoding::Converter.new("", "html-text-escaped") assert_equal('&<>"', 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('""', ec.convert('"')) + assert_equal('"', ec.finish) ec = Encoding::Converter.new("", "html-attr-escaped") - assert_equal('&<>"', ec.convert("&<>\"")) + assert_equal('"&<>"', ec.convert("&<>\"")) + assert_equal('"', ec.finish) end end |