ruby-changes:45426
From: nobu <ko1@a...>
Date: Thu, 2 Feb 2017 16:04:02 +0900 (JST)
Subject: [ruby-changes:45426] nobu:r57499 (trunk): test_cgi_util.rb: encoding tests
nobu 2017-02-02 16:03:59 +0900 (Thu, 02 Feb 2017) New Revision: 57499 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57499 Log: test_cgi_util.rb: encoding tests * test/cgi/test_cgi_util.rb (test_cgi_unescape): \u is useless on old versions. * test/cgi/test_cgi_util.rb (test_cgi_include_unescape): ditto. Modified files: trunk/test/cgi/test_cgi_util.rb Index: test/cgi/test_cgi_util.rb =================================================================== --- test/cgi/test_cgi_util.rb (revision 57498) +++ test/cgi/test_cgi_util.rb (revision 57499) @@ -42,8 +42,11 @@ class CGIUtilTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/cgi/test_cgi_util.rb#L42 end def test_cgi_unescape - assert_equal(@str1, CGI::unescape('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93')) - assert_equal(@str1.encoding, CGI::unescape('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93').encoding) if defined?(::Encoding) + str = CGI::unescape('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93') + assert_equal(@str1, str) + return unless defined?(::Encoding) + + assert_equal(@str1.encoding, str.encoding) assert_equal("\u{30E1 30E2 30EA 691C 7D22}", CGI.unescape("\u{30E1 30E2 30EA}%E6%A4%9C%E7%B4%A2")) end @@ -152,8 +155,11 @@ class CGIUtilTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/cgi/test_cgi_util.rb#L155 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) + str = unescape('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93') + assert_equal(@str1, str) + return unless defined?(::Encoding) + + assert_equal(@str1.encoding, str.encoding) assert_equal("\u{30E1 30E2 30EA 691C 7D22}", unescape("\u{30E1 30E2 30EA}%E6%A4%9C%E7%B4%A2")) end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/