summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-17 12:34:59 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-17 12:34:59 +0000
commite1b432754553423008a14d39d0901eabc99e7ddb (patch)
tree743e46d6fefc2ee305acf363ec966ce3126a0d56 /test
parent53127c2410c29f7cc942a76baa7be97ba65aafda (diff)
cgi/util.rb: Don't escape tilde in #escape
to make it compatible with ERB::Util.url_encode. ext/cgi/escape/escape.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/cgi/test_cgi_util.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/cgi/test_cgi_util.rb b/test/cgi/test_cgi_util.rb
index 02558892b2..65838ec2af 100644
--- a/test/cgi/test_cgi_util.rb
+++ b/test/cgi/test_cgi_util.rb
@@ -29,6 +29,12 @@ class CGIUtilTest < Test::Unit::TestCase
assert_equal('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93'.ascii_only?, CGI::escape(@str1).ascii_only?) if defined?(::Encoding)
end
+ def test_cgi_escape_with_unreserved_characters
+ assert_equal("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",
+ CGI::escape("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~"),
+ "should not escape any unreserved characters, as per RFC3986 Section 2.3")
+ end
+
def test_cgi_escape_with_invalid_byte_sequence
assert_nothing_raised(ArgumentError) do
assert_equal('%C0%3C%3C', CGI::escape("\xC0\<\<".dup.force_encoding("UTF-8")))