mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* ext/syck/rubyext.c: usec round-tripping skew. [ruby-core:2305]
* lib/yaml/rubytypes.rb: character Range now round-trips. [ruby-core:2306] * test/yaml/test_yaml.rb: add Time and Range tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									46f6b20268
								
							
						
					
					
						commit
						877408163a
					
				
					 4 changed files with 66 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -1051,6 +1051,28 @@ EOY
 | 
			
		|||
		)
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
    #
 | 
			
		||||
    # Test of Ranges
 | 
			
		||||
    #
 | 
			
		||||
    def test_ranges
 | 
			
		||||
 | 
			
		||||
        # Simple numeric
 | 
			
		||||
        assert_to_yaml( 1..3, <<EOY )
 | 
			
		||||
--- !ruby/range 1..3
 | 
			
		||||
EOY
 | 
			
		||||
 | 
			
		||||
        # Simple alphabetic
 | 
			
		||||
        assert_to_yaml( 'a'..'z', <<EOY )
 | 
			
		||||
--- !ruby/range a..z
 | 
			
		||||
EOY
 | 
			
		||||
 | 
			
		||||
        # Float
 | 
			
		||||
        assert_to_yaml( 10.5...30.3, <<EOY )
 | 
			
		||||
--- !ruby/range 10.5...30.3
 | 
			
		||||
EOY
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
	def test_ruby_struct
 | 
			
		||||
		# Ruby structures
 | 
			
		||||
		book_struct = Struct::new( "BookStruct", :author, :title, :year, :isbn )
 | 
			
		||||
| 
						 | 
				
			
			@ -1159,6 +1181,20 @@ EOY
 | 
			
		|||
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    #
 | 
			
		||||
    # Test Time.now cycle
 | 
			
		||||
    #
 | 
			
		||||
    def test_time_now_cycle
 | 
			
		||||
        #
 | 
			
		||||
        # From Minero Aoki [ruby-core:2305]
 | 
			
		||||
        #
 | 
			
		||||
        require 'yaml'
 | 
			
		||||
        t = Time.now
 | 
			
		||||
        5.times do
 | 
			
		||||
            assert_equals( t, YAML.load( YAML.dump( t ) ) )
 | 
			
		||||
        end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    #
 | 
			
		||||
    # Circular references
 | 
			
		||||
    #
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue