summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorÉtienne Barrié <[email protected]>2024-10-21 12:05:36 +0200
committerHiroshi SHIBATA <[email protected]>2024-10-26 18:44:15 +0900
commit44aef5e85200231dfe7d2868cf049ebb2622f530 (patch)
tree3702e39b7b3c8d90428b62b2d1aa0ccad6222562 /test
parent82f7550f65f9872f6d7bff1a876395c23bbd7fc1 (diff)
[ruby/json] Drop compatibility for missing Array#permutation (Ruby <= 1.8.6)
https://github.com/ruby/json/commit/b02091ed44 Co-authored-by: Jean Boussier <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/json/json_parser_test.rb28
1 files changed, 13 insertions, 15 deletions
diff --git a/test/json/json_parser_test.rb b/test/json/json_parser_test.rb
index 7197522def..e4300e94fd 100644
--- a/test/json/json_parser_test.rb
+++ b/test/json/json_parser_test.rb
@@ -133,23 +133,21 @@ class JSONParserTest < Test::Unit::TestCase
assert_equal(["éé"], JSON.parse("[\"\\u00e9é\"]"))
end
- if Array.method_defined?(:permutation)
- def test_parse_more_complex_arrays
- a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
- a.permutation.each do |perm|
- json = pretty_generate(perm)
- assert_equal perm, parse(json)
- end
+ def test_parse_more_complex_arrays
+ a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
+ a.permutation.each do |perm|
+ json = pretty_generate(perm)
+ assert_equal perm, parse(json)
end
+ end
- def test_parse_complex_objects
- a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
- a.permutation.each do |perm|
- s = "a"
- orig_obj = perm.inject({}) { |h, x| h[s.dup] = x; s = s.succ; h }
- json = pretty_generate(orig_obj)
- assert_equal orig_obj, parse(json)
- end
+ def test_parse_complex_objects
+ a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
+ a.permutation.each do |perm|
+ s = "a"
+ orig_obj = perm.inject({}) { |h, x| h[s.dup] = x; s = s.succ; h }
+ json = pretty_generate(orig_obj)
+ assert_equal orig_obj, parse(json)
end
end