-
-
Notifications
You must be signed in to change notification settings - Fork 776
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #521 from vcache/feature/dumper-spec-compilance
dumper: don't quote strings with # without need
- Loading branch information
Showing
3 changed files
with
50 additions
and
5 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,23 @@ | ||
'use strict'; | ||
|
||
|
||
var assert = require('assert'); | ||
var yaml = require('../../'); | ||
var readFileSync = require('fs').readFileSync; | ||
|
||
|
||
test('Don\'t quote strings with # without need', function () { | ||
var data = yaml.safeLoad(readFileSync(require('path').join(__dirname, '/0521.yml'), 'utf8')); | ||
|
||
var sample = { | ||
'http://example.com/page#anchor': 'no#quotes#required', | ||
'parameter#fallback': 'quotes #required', | ||
'foo #bar': 'key is quoted' | ||
}; | ||
|
||
assert.deepEqual( | ||
yaml.dump(sample), | ||
yaml.dump(data) | ||
); | ||
|
||
}); |
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,3 @@ | ||
http://example.com/page#anchor: no#quotes#required | ||
parameter#fallback: 'quotes #required' | ||
'foo #bar': key is quoted |