aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--ext/psych/lib/psych.rb1
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb2
-rw-r--r--test/psych/test_string.rb4
4 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9c949977ec..87b0a81091 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Thu Jan 9 09:55:20 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
+
Thu Jan 9 09:51:00 2014 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/visitors/to_ruby.rb: anonymous structs
diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb
index b5050b15e6..47802a48e7 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)