summaryrefslogtreecommitdiff
path: root/test/json/test_json.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-20 15:59:43 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-20 15:59:43 +0000
commitb32bae3fbb41c9766e12ccfe2f64ffc333129a5b (patch)
tree78ff9429867eb20e425a5218025a54172b2d45b2 /test/json/test_json.rb
parent070cbd942e6f6013ad4b9908f1dffe8dc156f5d0 (diff)
Use Array#permutation for permutation tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/json/test_json.rb')
-rwxr-xr-xtest/json/test_json.rb35
1 files changed, 14 insertions, 21 deletions
diff --git a/test/json/test_json.rb b/test/json/test_json.rb
index 5307609..ce90d6e 100755
--- a/test/json/test_json.rb
+++ b/test/json/test_json.rb
@@ -94,30 +94,23 @@ class TC_JSON < Test::Unit::TestCase
assert_equal({ "a" => 0.23 }, parse(' { "a" : 0.23 } '))
end
- begin
- require 'permutation'
- def test_parse_more_complex_arrays
- a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
- perms = Permutation.for a
- perms.each do |perm|
- orig_ary = perm.project
- json = pretty_generate(orig_ary)
- assert_equal orig_ary, 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|
+ orig_ary = a
+ json = pretty_generate(orig_ary)
+ assert_equal orig_ary, parse(json)
end
+ end
- def test_parse_complex_objects
- a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
- perms = Permutation.for a
- perms.each do |perm|
- s = "a"
- orig_obj = perm.project.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 = a.inject({}) { |h, x| h[s.dup] = x; s = s.succ; h }
+ json = pretty_generate(orig_obj)
+ assert_equal orig_obj, parse(json)
end
- rescue LoadError
- warn "Skipping permutation tests."
end
def test_parse_arrays