Skip to content

Commit

Permalink
* lib/yaml/rubytypes.rb: comments in strings. [ruby-talk:88012]
Browse files Browse the repository at this point in the history
* test/yaml/test_yaml.rb: add test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
why committed Dec 15, 2003
1 parent ee72d97 commit b75b945
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Tue Dec 16 03:17:29 2003 why the lucky stiff <[email protected]>

* lib/yaml/rubytypes.rb: comments in strings. [ruby-talk:88012]

* test/yaml/test_yaml.rb: add test.

Tue Dec 16 01:14:44 2003 Nobuyoshi Nakada <[email protected]>

* eval.c (catch_timer): check rb_thread_crtical in main native
Expand Down
2 changes: 1 addition & 1 deletion lib/yaml/rubytypes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def to_yaml( opts = {} )
self
elsif empty?
"''"
elsif self =~ /^[^#{YAML::WORD_CHAR}]|#{YAML::ESCAPE_CHAR}|[#{YAML::SPACE_INDICATORS}]( |$)| $|\n|\'/
elsif self =~ /^[^#{YAML::WORD_CHAR}]| \#|#{YAML::ESCAPE_CHAR}|[#{YAML::SPACE_INDICATORS}]( |$)| $|\n|\'/
"\"#{YAML.escape( self )}\""
elsif YAML.detect_implicit( self ) != 'str'
"\"#{YAML.escape( self )}\""
Expand Down
7 changes: 7 additions & 0 deletions test/yaml/test_yaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ def test_spec_mapping_of_mappings
)
end

def test_ambiguous_comments
# [ruby-talk:88012]
assert_to_yaml( "Call the method #dave", <<EOY )
--- "Call the method #dave"
EOY
end

def test_spec_nested_comments
# Map and sequences with comments
assert_parse_only(
Expand Down

0 comments on commit b75b945

Please sign in to comment.