diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-28 15:15:48 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-28 15:15:48 +0000 |
commit | 8c5b60eb22d6d661e87992a65d54e3a5bc0aeed4 (patch) | |
tree | 7905b284cb5b3d62c17ad8a939e339621a498a2c /spec/ruby/library/cgi/cookie/parse_spec.rb | |
parent | 6530b14cee76e2512424d225e64d3c61dd1f6511 (diff) | |
download | ruby-8c5b60eb22d6d661e87992a65d54e3a5bc0aeed4.tar.gz |
Update to ruby/spec@a6b8805
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/library/cgi/cookie/parse_spec.rb')
-rw-r--r-- | spec/ruby/library/cgi/cookie/parse_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/ruby/library/cgi/cookie/parse_spec.rb b/spec/ruby/library/cgi/cookie/parse_spec.rb index dc8498dcb4..6f615c0d23 100644 --- a/spec/ruby/library/cgi/cookie/parse_spec.rb +++ b/spec/ruby/library/cgi/cookie/parse_spec.rb @@ -10,6 +10,27 @@ describe "CGI::Cookie.parse" do CGI::Cookie.parse("first cookie=one&two;second cookie=three&four").should == expected end + ruby_version_is ""..."2.4" do + it "uses , for cookie separators" do + expected = { + "first cookie" => ["one", "two"], + "second cookie" => ["three", "four"], + "third_cookie" => ["five", "six"] + } + CGI::Cookie.parse("first cookie=one&two;second cookie=three&four,third_cookie=five&six").should == expected + end + end + + ruby_version_is "2.4" do + it "does not use , for cookie separators" do + expected = { + "first cookie" => ["one", "two"], + "second cookie" => ["three", "four,third_cookie=five", "six"] + } + CGI::Cookie.parse("first cookie=one&two;second cookie=three&four,third_cookie=five&six").should == expected + end + end + it "unescapes the Cookie values" do cookie = "test-cookie=+%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E" expected = { "test-cookie" => [ " !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ] } |