Skip to content

Commit

Permalink
Applied r4046:4047, fix dumping of multiline literals beginning with …
Browse files Browse the repository at this point in the history
…a space.

git-svn-id: http://svn.codehaus.org/jruby/branches/jruby-1_0@4098 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information
olabini committed Aug 6, 2007
1 parent 34a7ee0 commit 971f2bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/org/jvyamlb/EmitterImpl.java
Expand Up @@ -751,7 +751,7 @@ private char chooseScalarStyle() {
return '\'';
}

if(analysis.multiline) {
if(analysis.multiline && ev.getValue().charAt(0) != ' ') {
return '|';
}

Expand Down
6 changes: 6 additions & 0 deletions test/testYAML.rb
Expand Up @@ -116,3 +116,9 @@ class HashWithIndifferentAccess < Hash
need_to_be_serialized = {:first => 'something', :second_params => hash}
a = {:x => need_to_be_serialized.to_yaml}
test_equal need_to_be_serialized, YAML.load(YAML.load(a.to_yaml)[:x])

# JRUBY-1220
bad_text = " A\nR"
dump = YAML.dump({'text' => bad_text})
loaded = YAML.load(dump)
test_equal bad_text, loaded['text']

0 comments on commit 971f2bf

Please sign in to comment.