aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-20 08:33:33 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-20 08:33:33 +0000
commit20cd25c86fd28eb1b5068d0db607e6aa33107f65 (patch)
treecd5ddf4f9592ba06dc6fe2ad7144459d09de3241 /test
parent86b1179a03791002b6428f5b49754d7411933e9e (diff)
downloadruby-20cd25c86fd28eb1b5068d0db607e6aa33107f65.tar.gz
cgi/util.rb: remove CGI::Util#_unescape
* ext/cgi/escape/escape.c (cgiesc_unescape): define unescape method instead of _unescape, and should pass the optional argument to the super method. * lib/cgi/util.rb (CGI::Util#_unescape): remove intermediate method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/cgi/test_cgi_util.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/cgi/test_cgi_util.rb b/test/cgi/test_cgi_util.rb
index 62679b9c82..4e4f7a45e7 100644
--- a/test/cgi/test_cgi_util.rb
+++ b/test/cgi/test_cgi_util.rb
@@ -118,6 +118,23 @@ class CGIUtilTest < Test::Unit::TestCase
end
end
+ Encoding.list.each do |enc|
+ next unless enc.ascii_compatible?
+ begin
+ escaped = "%25+%2B"
+ unescaped = "% +".encode(enc)
+ rescue Encoding::ConverterNotFoundError
+ next
+ else
+ define_method("test_cgi_escape:#{enc.name}") do
+ assert_equal(escaped, CGI::escape(unescaped))
+ end
+ define_method("test_cgi_unescape:#{enc.name}") do
+ assert_equal(unescaped, CGI::unescape(escaped, enc))
+ end
+ end
+ end
+
def test_cgi_unescapeHTML_uppercasecharacter
assert_equal("\xE3\x81\x82\xE3\x81\x84\xE3\x81\x86", CGI::unescapeHTML("&#x3042;&#x3044;&#X3046;"))
end