* ext/psych/lib/psych/visitors/json_tree.rb (visit_String): JSON
strings should be dumped with double quotes. [ruby-core:34186] * test/psych/test_json_tree.rb: test for double quotes git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
76fe9e893c
commit
eacee9d95f
@ -1,3 +1,10 @@
|
|||||||
|
Tue Jan 18 02:46:55 2011 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
|
* ext/psych/lib/psych/visitors/json_tree.rb (visit_String): JSON
|
||||||
|
strings should be dumped with double quotes. [ruby-core:34186]
|
||||||
|
|
||||||
|
* test/psych/test_json_tree.rb: test for double quotes
|
||||||
|
|
||||||
Mon Jan 17 23:36:33 2011 Tanaka Akira <akr@fsij.org>
|
Mon Jan 17 23:36:33 2011 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* array.c (rb_ary_times): less MEMCPY calls.
|
* array.c (rb_ary_times): less MEMCPY calls.
|
||||||
|
@ -6,7 +6,7 @@ module Psych
|
|||||||
end
|
end
|
||||||
|
|
||||||
def visit_String o
|
def visit_String o
|
||||||
@emitter.scalar o.to_s, nil, nil, false, true, Nodes::Scalar::ANY
|
@emitter.scalar o.to_s, nil, nil, false, true, Nodes::Scalar::DOUBLE_QUOTED
|
||||||
end
|
end
|
||||||
alias :visit_Symbol :visit_String
|
alias :visit_Symbol :visit_String
|
||||||
end
|
end
|
||||||
|
@ -3,11 +3,11 @@ require_relative 'helper'
|
|||||||
module Psych
|
module Psych
|
||||||
class TestJSONTree < TestCase
|
class TestJSONTree < TestCase
|
||||||
def test_string
|
def test_string
|
||||||
assert_match(/(['"])foo\1/, Psych.to_json("foo"))
|
assert_match(/"foo"/, Psych.to_json("foo"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_symbol
|
def test_symbol
|
||||||
assert_match(/(['"])foo\1/, Psych.to_json(:foo))
|
assert_match(/"foo"/, Psych.to_json(:foo))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_nil
|
def test_nil
|
||||||
@ -36,8 +36,8 @@ module Psych
|
|||||||
json = Psych.to_json(list)
|
json = Psych.to_json(list)
|
||||||
assert_match(/]$/, json)
|
assert_match(/]$/, json)
|
||||||
assert_match(/^\[/, json)
|
assert_match(/^\[/, json)
|
||||||
assert_match(/['"]one['"]/, json)
|
assert_match(/"one"/, json)
|
||||||
assert_match(/['"]two['"]/, json)
|
assert_match(/"two"/, json)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user