1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
why 2003-12-15 18:17:43 +00:00
parent ee72d97e99
commit b75b9455ac
3 changed files with 14 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Tue Dec 16 03:17:29 2003 why the lucky stiff <why@ruby-lang.org>
* 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 <nobu@ruby-lang.org>
* eval.c (catch_timer): check rb_thread_crtical in main native

View file

@ -304,7 +304,7 @@ class String
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 )}\""

View file

@ -189,6 +189,13 @@ EOY
)
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(