forked from nodeca/js-yaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for leading newlines when determining if block indentation indi…
…cator is needed Fixes nodeca#403
- Loading branch information
Trevor Robinson
committed
Mar 15, 2018
1 parent
bb7f0cf
commit ead11df
Showing
2 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
|
||
var assert = require('assert'); | ||
var yaml = require('../../'); | ||
|
||
|
||
test('should properly dump leading newlines and spaces', function () { | ||
var dump, src; | ||
|
||
src = { str: '\n a\nb' }; | ||
dump = yaml.dump(src); | ||
assert.deepEqual(yaml.safeLoad(dump), src); | ||
|
||
src = { str: '\n\n a\nb' }; | ||
dump = yaml.dump(src); | ||
assert.deepEqual(yaml.safeLoad(dump), src); | ||
|
||
src = { str: '\n a\nb' }; | ||
dump = yaml.dump(src, { indent: 10 }); | ||
assert.deepEqual(yaml.safeLoad(dump), src); | ||
}); |