mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/psych/*: update psych to 2.0.16
* test/psych/*: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
56367e25ee
commit
a34e45fd54
10 changed files with 46 additions and 39 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Tue Dec 8 01:57:13 2015 Aaron Patterson <tenderlove@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/psych/*: update psych to 2.0.16
|
||||||
|
* test/psych/*: ditto
|
||||||
|
|
||||||
Mon Dec 7 23:45:20 2015 Koichi Sasada <ko1@atdot.net>
|
Mon Dec 7 23:45:20 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* string.c: introduce String#+@ and String#-@ to control
|
* string.c: introduce String#+@ and String#-@ to control
|
||||||
|
|
|
@ -223,7 +223,7 @@ require 'psych/class_loader'
|
||||||
|
|
||||||
module Psych
|
module Psych
|
||||||
# The version is Psych you're using
|
# The version is Psych you're using
|
||||||
VERSION = '2.0.15'
|
VERSION = '2.0.16'
|
||||||
|
|
||||||
# The version of libyaml Psych is using
|
# The version of libyaml Psych is using
|
||||||
LIBYAML_VERSION = Psych.libyaml_version.join '.'
|
LIBYAML_VERSION = Psych.libyaml_version.join '.'
|
||||||
|
|
|
@ -330,12 +330,13 @@ module Psych
|
||||||
list
|
list
|
||||||
end
|
end
|
||||||
|
|
||||||
|
SHOVEL = '<<'
|
||||||
def revive_hash hash, o
|
def revive_hash hash, o
|
||||||
o.children.each_slice(2) { |k,v|
|
o.children.each_slice(2) { |k,v|
|
||||||
key = accept(k)
|
key = accept(k)
|
||||||
val = accept(v)
|
val = accept(v)
|
||||||
|
|
||||||
if key == '<<' && k.tag != "tag:yaml.org,2002:str"
|
if key == SHOVEL && k.tag != "tag:yaml.org,2002:str"
|
||||||
case v
|
case v
|
||||||
when Nodes::Alias, Nodes::Mapping
|
when Nodes::Alias, Nodes::Mapping
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -70,6 +70,14 @@ module Psych
|
||||||
@ss = ss
|
@ss = ss
|
||||||
@options = options
|
@options = options
|
||||||
@line_width = options[:line_width]
|
@line_width = options[:line_width]
|
||||||
|
if @line_width && @line_width < 0
|
||||||
|
if @line_width == -1
|
||||||
|
# Treat -1 as unlimited line-width, same as libyaml does.
|
||||||
|
@line_width = nil
|
||||||
|
else
|
||||||
|
fail(ArgumentError, "Invalid line_width #{@line_width}, must be non-negative or -1 for unlimited.")
|
||||||
|
end
|
||||||
|
end
|
||||||
@coders = []
|
@coders = []
|
||||||
|
|
||||||
@dispatch_cache = Hash.new do |h,klass|
|
@dispatch_cache = Hash.new do |h,klass|
|
||||||
|
@ -510,21 +518,6 @@ module Psych
|
||||||
def dump_list o
|
def dump_list o
|
||||||
end
|
end
|
||||||
|
|
||||||
# '%:z' was no defined until 1.9.3
|
|
||||||
if RUBY_VERSION < '1.9.3'
|
|
||||||
def format_time time
|
|
||||||
formatted = time.strftime("%Y-%m-%d %H:%M:%S.%9N")
|
|
||||||
|
|
||||||
if time.utc?
|
|
||||||
formatted += " Z"
|
|
||||||
else
|
|
||||||
zone = time.strftime('%z')
|
|
||||||
formatted += " #{zone[0,3]}:#{zone[3,5]}"
|
|
||||||
end
|
|
||||||
|
|
||||||
formatted
|
|
||||||
end
|
|
||||||
else
|
|
||||||
def format_time time
|
def format_time time
|
||||||
if time.utc?
|
if time.utc?
|
||||||
time.strftime("%Y-%m-%d %H:%M:%S.%9N Z")
|
time.strftime("%Y-%m-%d %H:%M:%S.%9N Z")
|
||||||
|
@ -532,7 +525,6 @@ module Psych
|
||||||
time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")
|
time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# FIXME: remove this method once "to_yaml_properties" is removed
|
# FIXME: remove this method once "to_yaml_properties" is removed
|
||||||
def find_ivars target, is_primitive=false
|
def find_ivars target, is_primitive=false
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
|
# stub: psych 2.0.16 ruby lib
|
||||||
|
# stub: ext/psych/extconf.rb
|
||||||
|
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "psych"
|
s.name = "psych"
|
||||||
s.version = "2.0.15"
|
s.version = "2.0.16"
|
||||||
|
|
||||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
s.authors = ["Aaron Patterson"]
|
s.authors = ["Aaron Patterson"]
|
||||||
s.date = "2015-08-21"
|
s.date = "2015-12-07"
|
||||||
s.description = "Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]\nfor its YAML parsing and emitting capabilities. In addition to wrapping\nlibyaml, Psych also knows how to serialize and de-serialize most Ruby objects\nto and from the YAML format."
|
s.description = "Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]\nfor its YAML parsing and emitting capabilities. In addition to wrapping\nlibyaml, Psych also knows how to serialize and de-serialize most Ruby objects\nto and from the YAML format."
|
||||||
s.email = ["aaron@tenderlovemaking.com"]
|
s.email = ["aaron@tenderlovemaking.com"]
|
||||||
s.extensions = ["ext/psych/extconf.rb"]
|
s.extensions = ["ext/psych/extconf.rb"]
|
||||||
s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.rdoc"]
|
s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.rdoc"]
|
||||||
s.files = [".autotest", ".gemtest", "CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h", "ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h", "ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h", "ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c", "ext/psych/yaml/emitter.c", "ext/psych/yaml/loader.c", "ext/psych/yaml/parser.c", "ext/psych/yaml/reader.c", "ext/psych/yaml/scanner.c", "ext/psych/yaml/writer.c", "ext/psych/yaml/yaml.h", "ext/psych/yaml/yaml_private.h", "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/deprecated.rb", "lib/psych/exception.rb", "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb", "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb", "lib/psych/json/yaml_events.rb", "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", "lib/psych/nodes/document.rb", "lib/psych/nodes/mapping.rb", "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", "lib/psych/nodes/sequence.rb", "lib/psych/nodes/stream.rb", "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb", "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", "lib/psych/syntax_error.rb", "lib/psych/tree_builder.rb", "lib/psych/versions.rb", "lib/psych/visitors.rb", "lib/psych/visitors/depth_first.rb", "lib/psych/visitors/emitter.rb", "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb", "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", "lib/psych/y.rb", "lib/psych_jars.rb", "test/psych/handlers/test_recorder.rb", "test/psych/helper.rb", "test/psych/json/test_stream.rb", "test/psych/nodes/test_enumerable.rb", "test/psych/test_alias_and_anchor.rb", "test/psych/test_array.rb", "test/psych/test_boolean.rb", "test/psych/test_class.rb", "test/psych/test_coder.rb", "test/psych/test_date_time.rb", "test/psych/test_deprecated.rb", "test/psych/test_document.rb", "test/psych/test_emitter.rb", "test/psych/test_encoding.rb", "test/psych/test_exception.rb", "test/psych/test_hash.rb", "test/psych/test_json_tree.rb", "test/psych/test_merge_keys.rb", "test/psych/test_nil.rb", "test/psych/test_null.rb", "test/psych/test_numeric.rb", "test/psych/test_object.rb", "test/psych/test_object_references.rb", "test/psych/test_omap.rb", "test/psych/test_parser.rb", "test/psych/test_psych.rb", "test/psych/test_safe_load.rb", "test/psych/test_scalar.rb", "test/psych/test_scalar_scanner.rb", "test/psych/test_serialize_subclasses.rb", "test/psych/test_set.rb", "test/psych/test_stream.rb", "test/psych/test_string.rb", "test/psych/test_struct.rb", "test/psych/test_symbol.rb", "test/psych/test_tainted.rb", "test/psych/test_to_yaml_properties.rb", "test/psych/test_tree_builder.rb", "test/psych/test_yaml.rb", "test/psych/test_yamldbm.rb", "test/psych/test_yamlstore.rb", "test/psych/visitors/test_depth_first.rb", "test/psych/visitors/test_emitter.rb", "test/psych/visitors/test_to_ruby.rb", "test/psych/visitors/test_yaml_tree.rb"]
|
s.files = [".autotest", ".travis.yml", "CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h", "ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h", "ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h", "ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c", "ext/psych/yaml/emitter.c", "ext/psych/yaml/loader.c", "ext/psych/yaml/parser.c", "ext/psych/yaml/reader.c", "ext/psych/yaml/scanner.c", "ext/psych/yaml/writer.c", "ext/psych/yaml/yaml.h", "ext/psych/yaml/yaml_private.h", "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/deprecated.rb", "lib/psych/exception.rb", "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb", "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb", "lib/psych/json/yaml_events.rb", "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", "lib/psych/nodes/document.rb", "lib/psych/nodes/mapping.rb", "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", "lib/psych/nodes/sequence.rb", "lib/psych/nodes/stream.rb", "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb", "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", "lib/psych/syntax_error.rb", "lib/psych/tree_builder.rb", "lib/psych/versions.rb", "lib/psych/visitors.rb", "lib/psych/visitors/depth_first.rb", "lib/psych/visitors/emitter.rb", "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb", "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", "lib/psych/y.rb", "lib/psych_jars.rb", "test/psych/handlers/test_recorder.rb", "test/psych/helper.rb", "test/psych/json/test_stream.rb", "test/psych/nodes/test_enumerable.rb", "test/psych/test_alias_and_anchor.rb", "test/psych/test_array.rb", "test/psych/test_boolean.rb", "test/psych/test_class.rb", "test/psych/test_coder.rb", "test/psych/test_date_time.rb", "test/psych/test_deprecated.rb", "test/psych/test_document.rb", "test/psych/test_emitter.rb", "test/psych/test_encoding.rb", "test/psych/test_exception.rb", "test/psych/test_hash.rb", "test/psych/test_json_tree.rb", "test/psych/test_merge_keys.rb", "test/psych/test_nil.rb", "test/psych/test_null.rb", "test/psych/test_numeric.rb", "test/psych/test_object.rb", "test/psych/test_object_references.rb", "test/psych/test_omap.rb", "test/psych/test_parser.rb", "test/psych/test_psych.rb", "test/psych/test_safe_load.rb", "test/psych/test_scalar.rb", "test/psych/test_scalar_scanner.rb", "test/psych/test_serialize_subclasses.rb", "test/psych/test_set.rb", "test/psych/test_stream.rb", "test/psych/test_string.rb", "test/psych/test_struct.rb", "test/psych/test_symbol.rb", "test/psych/test_tainted.rb", "test/psych/test_to_yaml_properties.rb", "test/psych/test_tree_builder.rb", "test/psych/test_yaml.rb", "test/psych/test_yamldbm.rb", "test/psych/test_yamlstore.rb", "test/psych/visitors/test_depth_first.rb", "test/psych/visitors/test_emitter.rb", "test/psych/visitors/test_to_ruby.rb", "test/psych/visitors/test_yaml_tree.rb"]
|
||||||
s.homepage = "http://github.com/tenderlove/psych"
|
s.homepage = "http://github.com/tenderlove/psych"
|
||||||
s.licenses = ["MIT"]
|
s.licenses = ["MIT"]
|
||||||
s.rdoc_options = ["--main", "README.rdoc"]
|
s.rdoc_options = ["--main", "README.rdoc"]
|
||||||
|
|
|
@ -2053,7 +2053,7 @@ yaml_parser_scan_directive(yaml_parser_t *parser, yaml_token_t *token)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yaml_parser_set_scanner_error(parser, "while scanning a directive",
|
yaml_parser_set_scanner_error(parser, "while scanning a directive",
|
||||||
start_mark, "found uknown directive name");
|
start_mark, "found unknown directive name");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ module Psych
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# backport so that tests will run on 1.9 and 2.0.0
|
# backport so that tests will run on 2.0.0
|
||||||
unless Tempfile.respond_to? :create
|
unless Tempfile.respond_to? :create
|
||||||
def Tempfile.create(basename, *rest)
|
def Tempfile.create(basename, *rest)
|
||||||
tmpfile = nil
|
tmpfile = nil
|
||||||
|
|
|
@ -8,7 +8,17 @@ class TestPsych < Psych::TestCase
|
||||||
Psych.domain_types.clear
|
Psych.domain_types.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_line_width
|
def test_line_width_invalid
|
||||||
|
assert_raises(ArgumentError) { Psych.dump('x', { :line_width => -2 }) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_line_width_no_limit
|
||||||
|
data = { 'a' => 'a b' * 50}
|
||||||
|
expected = "---\na: #{'a b' * 50}\n"
|
||||||
|
assert_equal(expected, Psych.dump(data, { :line_width => -1 }))
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_line_width_limit
|
||||||
yml = Psych.dump('123456 7', { :line_width => 5 })
|
yml = Psych.dump('123456 7', { :line_width => 5 })
|
||||||
assert_match(/^\s*7/, yml)
|
assert_match(/^\s*7/, yml)
|
||||||
end
|
end
|
||||||
|
|
|
@ -77,7 +77,6 @@ module Psych
|
||||||
# end
|
# end
|
||||||
|
|
||||||
def test_key
|
def test_key
|
||||||
skip 'only on ruby 2.0.0' if RUBY_VERSION < '2.0.0'
|
|
||||||
@yamldbm['a'] = 'b'
|
@yamldbm['a'] = 'b'
|
||||||
@yamldbm['c'] = 'd'
|
@yamldbm['c'] = 'd'
|
||||||
assert_equal 'a', @yamldbm.key('b')
|
assert_equal 'a', @yamldbm.key('b')
|
||||||
|
|
|
@ -166,7 +166,6 @@ description:
|
||||||
assert_equal Complex(1,2), mapping.to_ruby
|
assert_equal Complex(1,2), mapping.to_ruby
|
||||||
end
|
end
|
||||||
|
|
||||||
if RUBY_VERSION >= '1.9'
|
|
||||||
def test_complex_string
|
def test_complex_string
|
||||||
node = Nodes::Scalar.new '3+4i', nil, "!ruby/object:Complex"
|
node = Nodes::Scalar.new '3+4i', nil, "!ruby/object:Complex"
|
||||||
assert_equal Complex(3, 4), node.to_ruby
|
assert_equal Complex(3, 4), node.to_ruby
|
||||||
|
@ -176,7 +175,6 @@ description:
|
||||||
node = Nodes::Scalar.new '1/2', nil, "!ruby/object:Rational"
|
node = Nodes::Scalar.new '1/2', nil, "!ruby/object:Rational"
|
||||||
assert_equal Rational(1, 2), node.to_ruby
|
assert_equal Rational(1, 2), node.to_ruby
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def test_range_string
|
def test_range_string
|
||||||
node = Nodes::Scalar.new '1..2', nil, "!ruby/range"
|
node = Nodes::Scalar.new '1..2', nil, "!ruby/range"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue