aboutsummaryrefslogtreecommitdiffstats
path: root/community/ruby-escape_utils/fix-tests-for-ruby-2.5.patch
blob: 0579a99ab6bad33bbba98c3a07a2fa71678d76fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
CGI.escape does not escape "~" since Ruby 2.5.

--- a/test/uri_component/escape_test.rb
+++ b/test/uri_component/escape_test.rb
@@ -10,8 +10,9 @@
     (0..127).each do |i|
       c = i.chr
       # Escaping URI path components should match CGI parameter escaping, except
-      # spaces should be escaped as "%20" instead of "+"
-      assert_equal CGI.escape(c).sub("+", "%20"), EscapeUtils.escape_uri_component(c)
+      # spaces should be escaped as "%20" instead of "+" and "~" should be
+      # escaped as "%7E".
+      assert_equal CGI.escape(c).sub("+", "%20").sub("~", "%7E"), EscapeUtils.escape_uri_component(c)
     end
   end
 
--- a/test/url/escape_test.rb
+++ b/test/url/escape_test.rb
@@ -9,7 +9,7 @@
   def test_cgi_stdlib_compatibility
     (0..127).each do |i|
       c = i.chr
-      assert_equal CGI.escape(c), EscapeUtils.escape_url(c)
+      assert_equal CGI.escape(c).sub("~", "%7E"), EscapeUtils.escape_url(c)
     end
   end