* test/json/test_json.rb: remove dependency on permutation gem.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
945faf92e6
commit
2b3f026b8a
@ -1,3 +1,7 @@
|
|||||||
|
Sun Oct 26 21:28:42 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
|
* test/json/test_json.rb: remove dependency on permutation gem.
|
||||||
|
|
||||||
Sun Oct 26 19:18:36 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Oct 26 19:18:36 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* thread.c (blocking_region_{begin,end}): declared as inline.
|
* thread.c (blocking_region_{begin,end}): declared as inline.
|
||||||
|
@ -90,13 +90,9 @@ class TC_JSON < Test::Unit::TestCase
|
|||||||
assert_equal({ "a" => 0.23 }, parse(' { "a" : 0.23 } '))
|
assert_equal({ "a" => 0.23 }, parse(' { "a" : 0.23 } '))
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
|
||||||
require 'permutation'
|
|
||||||
def test_parse_more_complex_arrays
|
def test_parse_more_complex_arrays
|
||||||
a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
|
a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
|
||||||
perms = Permutation.for a
|
a.permutation do |orig_ary|
|
||||||
perms.each do |perm|
|
|
||||||
orig_ary = perm.project
|
|
||||||
json = pretty_generate(orig_ary)
|
json = pretty_generate(orig_ary)
|
||||||
assert_equal orig_ary, parse(json)
|
assert_equal orig_ary, parse(json)
|
||||||
end
|
end
|
||||||
@ -104,17 +100,13 @@ class TC_JSON < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_parse_complex_objects
|
def test_parse_complex_objects
|
||||||
a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
|
a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
|
||||||
perms = Permutation.for a
|
a.permutation do |orig_ary|
|
||||||
perms.each do |perm|
|
|
||||||
s = "a"
|
s = "a"
|
||||||
orig_obj = perm.project.inject({}) { |h, x| h[s.dup] = x; s = s.succ; h }
|
orig_obj = orig_ary.inject({}) { |h, x| h[s.dup] = x; s = s.succ; h }
|
||||||
json = pretty_generate(orig_obj)
|
json = pretty_generate(orig_obj)
|
||||||
assert_equal orig_obj, parse(json)
|
assert_equal orig_obj, parse(json)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue LoadError
|
|
||||||
warn "Skipping permutation tests."
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_parse_arrays
|
def test_parse_arrays
|
||||||
assert_equal([1,2,3], parse('[1,2,3]'))
|
assert_equal([1,2,3], parse('[1,2,3]'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user