Sha256: 6a724f24636e00776c0f58e182fe3b3940692d66f3281003a0f599ae5081dfc4

Contents?: true

Size: 1.23 KB

Versions: 8

Compression:

Stored size: 1.23 KB

Contents

require 'psych/helper'
require 'yaml'

module Psych
 class TestEngineManager < TestCase
   def teardown
     YAML::ENGINE.yamler = 'syck'
   end

   def test_bad_engine
     assert_raises(ArgumentError) do
       YAML::ENGINE.yamler = 'foooo'
     end
   end

   def test_set_psych
     YAML::ENGINE.yamler = 'psych'
     assert_equal Psych, YAML
     assert_equal 'psych', YAML::ENGINE.yamler
   end

   def test_set_syck
     YAML::ENGINE.yamler = 'syck'
     assert_equal ::Syck, YAML
     assert_equal 'syck', YAML::ENGINE.yamler
   end

   A = Struct.new(:name)

   def test_dump_types
     YAML::ENGINE.yamler = 'psych'

     assert_to_yaml ::Object.new
     assert_to_yaml Time.now
     assert_to_yaml Date.today
     assert_to_yaml('a' => 'b')
     assert_to_yaml A.new('foo')
     assert_to_yaml %w{a b}
     assert_to_yaml Exception.new('foo')
     assert_to_yaml "hello!"
     assert_to_yaml :fooo
     assert_to_yaml(1..10)
     assert_to_yaml(/hello!~/)
     assert_to_yaml 1
     assert_to_yaml 1.2
     assert_to_yaml Rational(1, 2)
     assert_to_yaml Complex(1, 2)
     assert_to_yaml true
     assert_to_yaml false
     assert_to_yaml nil
   end

   def assert_to_yaml obj
     assert obj.to_yaml, "#{obj.class} to_yaml works"
   end
 end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
psych-1.3.4 test/psych/test_engine_manager.rb
psych-1.3.3 test/psych/test_engine_manager.rb
psych-1.3.2 test/psych/test_engine_manager.rb
psych-1.3.1 test/psych/test_engine_manager.rb
psych-1.3.0 test/psych/test_engine_manager.rb
psych-1.2.2 test/psych/test_engine_manager.rb
psych-1.2.2.rc1 test/psych/test_engine_manager.rb
psych-1.2.1 test/psych/test_engine_manager.rb