diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-07 16:58:10 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-07 16:58:10 +0000 |
commit | a34e45fd546ac30f254237ab743120372f76935f (patch) | |
tree | 73778b242ce07f61ed0861409e473888251b056f /test/psych | |
parent | 56367e25ee9ae99694a2e69f6c2de0dfa9956211 (diff) |
* 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
Diffstat (limited to 'test/psych')
-rw-r--r-- | test/psych/helper.rb | 2 | ||||
-rw-r--r-- | test/psych/test_psych.rb | 12 | ||||
-rw-r--r-- | test/psych/test_yamldbm.rb | 1 | ||||
-rw-r--r-- | test/psych/visitors/test_to_ruby.rb | 16 |
4 files changed, 19 insertions, 12 deletions
diff --git a/test/psych/helper.rb b/test/psych/helper.rb index f28ac0f965..3bbb459320 100644 --- a/test/psych/helper.rb +++ b/test/psych/helper.rb @@ -91,7 +91,7 @@ module Psych 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 def Tempfile.create(basename, *rest) tmpfile = nil diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb index 8054bd6234..05a93438bc 100644 --- a/test/psych/test_psych.rb +++ b/test/psych/test_psych.rb @@ -8,7 +8,17 @@ class TestPsych < Psych::TestCase Psych.domain_types.clear 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 }) assert_match(/^\s*7/, yml) end diff --git a/test/psych/test_yamldbm.rb b/test/psych/test_yamldbm.rb index 785365841e..62c88b753e 100644 --- a/test/psych/test_yamldbm.rb +++ b/test/psych/test_yamldbm.rb @@ -77,7 +77,6 @@ module Psych # end def test_key - skip 'only on ruby 2.0.0' if RUBY_VERSION < '2.0.0' @yamldbm['a'] = 'b' @yamldbm['c'] = 'd' assert_equal 'a', @yamldbm.key('b') diff --git a/test/psych/visitors/test_to_ruby.rb b/test/psych/visitors/test_to_ruby.rb index 5c6ba2b397..19e5365244 100644 --- a/test/psych/visitors/test_to_ruby.rb +++ b/test/psych/visitors/test_to_ruby.rb @@ -166,16 +166,14 @@ description: assert_equal Complex(1,2), mapping.to_ruby end - if RUBY_VERSION >= '1.9' - def test_complex_string - node = Nodes::Scalar.new '3+4i', nil, "!ruby/object:Complex" - assert_equal Complex(3, 4), node.to_ruby - end + def test_complex_string + node = Nodes::Scalar.new '3+4i', nil, "!ruby/object:Complex" + assert_equal Complex(3, 4), node.to_ruby + end - def test_rational_string - node = Nodes::Scalar.new '1/2', nil, "!ruby/object:Rational" - assert_equal Rational(1, 2), node.to_ruby - end + def test_rational_string + node = Nodes::Scalar.new '1/2', nil, "!ruby/object:Rational" + assert_equal Rational(1, 2), node.to_ruby end def test_range_string |