forked from nodeca/js-yaml
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
12 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,46 @@ | ||
'use strict'; | ||
|
||
var assert = require('assert'); | ||
var yaml = require('../..'); | ||
|
||
test('should not unnecessaryly apply quotes', function () { | ||
|
||
var expected = 'url: https://github.com/nodeca/js-yaml\n'; | ||
var actual = yaml.dump( | ||
{ | ||
url: 'https://github.com/nodeca/js-yaml' | ||
} | ||
); | ||
|
||
assert.strictEqual(actual, expected); | ||
}); | ||
test('should not unnecessaryly apply quotes - ', function () { | ||
|
||
var expected = 'url: https://github.com/nodeca/js-yaml\n'; | ||
|
||
var obj = {}; | ||
obj['url'] = 'https://github.com/nodeca/js-yaml'; | ||
|
||
var actual = yaml.dump(obj); | ||
|
||
assert.strictEqual(actual, expected); | ||
}); | ||
|
||
test('should not unnecessaryly apply quotes - space then /\n at end of value', function () { | ||
|
||
var expected = 'url: \'https://github.com/nodeca/js-yaml \'\n'; | ||
|
||
var obj = {}; | ||
obj['url'] = 'https://github.com/nodeca/js-yaml '; | ||
|
||
var actual = yaml.dump(obj); | ||
|
||
assert.strictEqual(actual, expected); | ||
}); | ||
test('should not unnecessaryly apply quotes - space after colon', function () { | ||
|
||
var expected = 'url: \'https: //github.com/nodeca/js-yaml\'\n'; | ||
var actual = yaml.dump({ url: 'https: //github.com/nodeca/js-yaml' }); | ||
|
||
assert.strictEqual(actual, expected); | ||
}); |