diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-21 14:06:17 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-21 14:06:17 +0000 |
commit | 1d5d057531189c43ed603a7d9105bdfca71e3319 (patch) | |
tree | b34d8139ca78b5f05602ebbeb27f5e94fa03cb36 | |
parent | cb6602490b055fba2a1a340ffa1e276c0b9cff95 (diff) |
merge revision(s) 44531: [Backport #9300]
* 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
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | ext/psych/lib/psych.rb | 1 | ||||
-rw-r--r-- | ext/psych/lib/psych/visitors/yaml_tree.rb | 2 | ||||
-rw-r--r-- | test/psych/test_string.rb | 4 | ||||
-rw-r--r-- | version.h | 2 |
5 files changed, 16 insertions, 2 deletions
@@ -1,3 +1,12 @@ +Fri Feb 21 23:00:34 2014 Aaron Patterson <aaron@tenderlovemaking.com> + + * 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 + Sun Feb 2 05:48:42 2014 Eric Wong <e@80x24.org> * io.c (rb_io_syswrite): add RB_GC_GUARD diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb index 2a87f43efe..45e01c5fd1 100644 --- a/ext/psych/lib/psych.rb +++ b/ext/psych/lib/psych.rb @@ -14,6 +14,7 @@ require 'psych/stream' require 'psych/json/tree_builder' require 'psych/json/stream' require 'psych/handlers/document_stream' +require 'psych/class_loader' ### # = Overview diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb index 1cb2137693..f89fcbb8f1 100644 --- a/ext/psych/lib/psych/visitors/yaml_tree.rb +++ b/ext/psych/lib/psych/visitors/yaml_tree.rb @@ -284,7 +284,7 @@ module Psych 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) diff --git a/test/psych/test_string.rb b/test/psych/test_string.rb index 84326da8d3..01fc0e4bb0 100644 --- a/test/psych/test_string.rb +++ b/test/psych/test_string.rb @@ -15,6 +15,10 @@ module Psych 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) @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.1" #define RUBY_RELEASE_DATE "2014-02-21" -#define RUBY_PATCHLEVEL 43 +#define RUBY_PATCHLEVEL 44 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 2 |