[前][次][番号順一覧][スレッド一覧]

ruby-changes:32452

From: tenderlove <ko1@a...>
Date: Thu, 9 Jan 2014 09:56:58 +0900 (JST)
Subject: [ruby-changes:32452] tenderlove:r44531 (trunk): * ext/psych/lib/psych/visitors/yaml_tree.rb: dumping strings with

tenderlove	2014-01-09 09:56:45 +0900 (Thu, 09 Jan 2014)

  New Revision: 44531

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44531

  Log:
    * ext/psych/lib/psych/visitors/yaml_tree.rb: dumping strings with
      quotes should not have changed.  [ruby-core:59316] [Bug #9300]
    
    * ext/psych/lib/psych.rb: fixed missing require.
    
    * test/psych/test_string.rb: test

  Modified files:
    trunk/ChangeLog
    trunk/ext/psych/lib/psych/visitors/yaml_tree.rb
    trunk/ext/psych/lib/psych.rb
    trunk/test/psych/test_string.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44530)
+++ ChangeLog	(revision 44531)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jan  9 09:55:20 2014  Aaron Patterson <aaron@t...>
+
+	* ext/psych/lib/psych/visitors/yaml_tree.rb: dumping strings with
+	  quotes should not have changed.  [ruby-core:59316] [Bug #9300]
+
+	* ext/psych/lib/psych.rb: fixed missing require.
+
+	* test/psych/test_string.rb: test
+
 Thu Jan  9 09:51:00 2014  Aaron Patterson <aaron@t...>
 
 	* ext/psych/lib/psych/visitors/to_ruby.rb: anonymous structs
Index: ext/psych/lib/psych/visitors/yaml_tree.rb
===================================================================
--- ext/psych/lib/psych/visitors/yaml_tree.rb	(revision 44530)
+++ ext/psych/lib/psych/visitors/yaml_tree.rb	(revision 44531)
@@ -284,7 +284,7 @@ module Psych https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych/visitors/yaml_tree.rb#L284
           quote = false
         elsif o =~ /\n/
           style = Nodes::Scalar::LITERAL
-        elsif o =~ /^\W/
+        elsif o =~ /^\W[^"]*$/
           style = Nodes::Scalar::DOUBLE_QUOTED
         else
           unless String === @ss.tokenize(o)
Index: ext/psych/lib/psych.rb
===================================================================
--- ext/psych/lib/psych.rb	(revision 44530)
+++ ext/psych/lib/psych.rb	(revision 44531)
@@ -14,6 +14,7 @@ require 'psych/stream' https://github.com/ruby/ruby/blob/trunk/ext/psych/lib/psych.rb#L14
 require 'psych/json/tree_builder'
 require 'psych/json/stream'
 require 'psych/handlers/document_stream'
+require 'psych/class_loader'
 
 ###
 # = Overview
Index: test/psych/test_string.rb
===================================================================
--- test/psych/test_string.rb	(revision 44530)
+++ test/psych/test_string.rb	(revision 44531)
@@ -15,6 +15,10 @@ module Psych https://github.com/ruby/ruby/blob/trunk/test/psych/test_string.rb#L15
       end
     end
 
+    def test_no_doublequotes_with_special_characters
+      assert_equal 2, Psych.dump(%Q{<%= ENV["PATH"] %>}).count('"')
+    end
+
     def test_doublequotes_when_there_is_a_single
       yaml = Psych.dump "@123'abc"
       assert_match(/---\s*"/, yaml)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]