mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* ext/psych/lib/psych/visitors/yaml_tree.rb: fix time dumping so that
Syck can load UTC times that Psych dumps. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									fb58474627
								
							
						
					
					
						commit
						d47073de04
					
				
					 5 changed files with 14 additions and 3 deletions
				
			
		| 
						 | 
					@ -1,3 +1,8 @@
 | 
				
			||||||
 | 
					Wed May  4 08:04:59 2011  Aaron Patterson <aaron@tenderlovemaking.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* ext/psych/lib/psych/visitors/yaml_tree.rb: fix time dumping so that
 | 
				
			||||||
 | 
						  Syck can load UTC times that Psych dumps.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Wed May  4 07:33:00 2011  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
 | 
					Wed May  4 07:33:00 2011  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* thread.c (rb_fd_copy): fix wrong argument.This issue was pointed
 | 
						* thread.c (rb_fd_copy): fix wrong argument.This issue was pointed
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -297,7 +297,7 @@ module Psych
 | 
				
			||||||
      private
 | 
					      private
 | 
				
			||||||
      def format_time time
 | 
					      def format_time time
 | 
				
			||||||
        if time.utc?
 | 
					        if time.utc?
 | 
				
			||||||
          time.strftime("%Y-%m-%d %H:%M:%S.%9NZ")
 | 
					          time.strftime("%Y-%m-%d %H:%M:%S.%9N Z")
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
          time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")
 | 
					          time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -95,7 +95,7 @@ module Psych
 | 
				
			||||||
        time = Time.utc(2010, 10, 10)
 | 
					        time = Time.utc(2010, 10, 10)
 | 
				
			||||||
        @stream.push({'a' => time })
 | 
					        @stream.push({'a' => time })
 | 
				
			||||||
        json = @io.string
 | 
					        json = @io.string
 | 
				
			||||||
        assert_match "{\"a\": \"2010-10-10 00:00:00.000000000Z\"}\n", json
 | 
					        assert_match "{\"a\": \"2010-10-10 00:00:00.000000000 Z\"}\n", json
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      def test_datetime
 | 
					      def test_datetime
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,7 +53,7 @@ module Psych
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_time
 | 
					    def test_time
 | 
				
			||||||
      time = Time.utc(2010, 10, 10)
 | 
					      time = Time.utc(2010, 10, 10)
 | 
				
			||||||
      assert_equal "{\"a\": \"2010-10-10 00:00:00.000000000Z\"}\n",
 | 
					      assert_equal "{\"a\": \"2010-10-10 00:00:00.000000000 Z\"}\n",
 | 
				
			||||||
Psych.to_json({'a' => time })
 | 
					Psych.to_json({'a' => time })
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,6 +14,12 @@ class Psych_Unit_Tests < Psych::TestCase
 | 
				
			||||||
        Psych.domain_types.clear
 | 
					        Psych.domain_types.clear
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_syck_compat
 | 
				
			||||||
 | 
					      time = Time.utc(2010, 10, 10)
 | 
				
			||||||
 | 
					      yaml = Psych.dump time
 | 
				
			||||||
 | 
					      assert_match "2010-10-10 00:00:00.000000000 Z", yaml
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # [ruby-core:34969]
 | 
					    # [ruby-core:34969]
 | 
				
			||||||
    def test_regexp_with_n
 | 
					    def test_regexp_with_n
 | 
				
			||||||
        assert_cycle(Regexp.new('',0,'n'))
 | 
					        assert_cycle(Regexp.new('',0,'n'))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue