diff options
author | Bas Van Klinkenberg <bas@vanklinkenbergsoftware.nl> | 2009-08-01 02:24:40 +0200 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-08-08 12:44:41 -0300 |
commit | 0fbeaa98e4e60ca0949be298dae8545807407e1d (patch) | |
tree | 6675ab887da3598338f3bb26384d937c1574c208 /activesupport/test/json | |
parent | d0301e13f4d6e2ddf956ecf80e85384c1ea5346c (diff) | |
download | rails-0fbeaa98e4e60ca0949be298dae8545807407e1d.tar.gz rails-0fbeaa98e4e60ca0949be298dae8545807407e1d.tar.bz2 rails-0fbeaa98e4e60ca0949be298dae8545807407e1d.zip |
Fixed a bug in JSON decoding with Yaml backend, where a combination of dates, escaped or unicode encoded data and arrays would make the parser fail with a ParseError exception. [#2831 state:resolved]
Signed-off-by: Yehuda Katz <wycats@gmail.com>
Diffstat (limited to 'activesupport/test/json')
-rw-r--r-- | activesupport/test/json/decoding_test.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/activesupport/test/json/decoding_test.rb b/activesupport/test/json/decoding_test.rb index 09fd0d09ba..4129a4fab6 100644 --- a/activesupport/test/json/decoding_test.rb +++ b/activesupport/test/json/decoding_test.rb @@ -33,7 +33,13 @@ class TestJSONDecoding < ActiveSupport::TestCase %q({"a": "\u003cunicode\u0020escape\u003e"}) => {"a" => "<unicode escape>"}, %q({"a": "\\\\u0020skip double backslashes"}) => {"a" => "\\u0020skip double backslashes"}, %q({"a": "\u003cbr /\u003e"}) => {'a' => "<br />"}, - %q({"b":["\u003ci\u003e","\u003cb\u003e","\u003cu\u003e"]}) => {'b' => ["<i>","<b>","<u>"]} + %q({"b":["\u003ci\u003e","\u003cb\u003e","\u003cu\u003e"]}) => {'b' => ["<i>","<b>","<u>"]}, + # test combination of dates and escaped or unicode encoded data in arrays + %q([{"d":"1970-01-01", "s":"\u0020escape"},{"d":"1970-01-01", "s":"\u0020escape"}]) => + [{'d' => Date.new(1970, 1, 1), 's' => ' escape'},{'d' => Date.new(1970, 1, 1), 's' => ' escape'}], + %q([{"d":"1970-01-01","s":"http:\/\/example.com"},{"d":"1970-01-01","s":"http:\/\/example.com"}]) => + [{'d' => Date.new(1970, 1, 1), 's' => 'http://example.com'}, + {'d' => Date.new(1970, 1, 1), 's' => 'http://example.com'}] } # load the default JSON backend |