summaryrefslogtreecommitdiff
path: root/test/cgi
diff options
context:
space:
mode:
authorxibbar <xibbar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-03 11:23:23 +0000
committerxibbar <xibbar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-03 11:23:23 +0000
commitb35529bb4e9b7c1f328e4515106b4b96aec94167 (patch)
tree67744d1c4e8a9cf684cea0bc30ced0eecf1773e6 /test/cgi
parent86d4511fe6944f5517ead2679a0a4900d2db8ee5 (diff)
* lib/cgi/util.rb: class methods modulize for using like a function.
[Feature #8354] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/cgi')
-rw-r--r--test/cgi/test_cgi_util.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/cgi/test_cgi_util.rb b/test/cgi/test_cgi_util.rb
index 7129cb6..de5cfe1 100644
--- a/test/cgi/test_cgi_util.rb
+++ b/test/cgi/test_cgi_util.rb
@@ -4,7 +4,7 @@ require 'stringio'
class CGIUtilTest < Test::Unit::TestCase
-
+ include CGI::Util
def setup
ENV['REQUEST_METHOD'] = 'GET'
@@ -65,4 +65,25 @@ class CGIUtilTest < Test::Unit::TestCase
assert_equal(CGI::unescapeHTML("&#x3042;&#x3044;&#X3046;"),"\xE3\x81\x82\xE3\x81\x84\xE3\x81\x86")
end
+ def test_cgi_include_escape
+ assert_equal('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93', escape(@str1))
+ end
+
+ def test_cgi_include_escapeHTML
+ assert_equal(escapeHTML("'&\"><"),"&#39;&amp;&quot;&gt;&lt;")
+ end
+
+ def test_cgi_include_h
+ assert_equal(h("'&\"><"),"&#39;&amp;&quot;&gt;&lt;")
+ end
+
+ def test_cgi_include_unescape
+ assert_equal(@str1, unescape('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93'))
+ assert_equal(@str1.encoding, unescape('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93').encoding) if defined?(::Encoding)
+ assert_equal("\u{30E1 30E2 30EA 691C 7D22}", unescape("\u{30E1 30E2 30EA}%E6%A4%9C%E7%B4%A2"))
+ end
+
+ def test_cgi_include_unescapeHTML
+ assert_equal(unescapeHTML("&#39;&amp;&quot;&gt;&lt;"),"'&\"><")
+ end
end