Skip to content

Commit

Permalink
Fix #521 test and add more useful cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Himura2la committed Jun 17, 2020
1 parent 089c36e commit db3eb34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
17 changes: 6 additions & 11 deletions test/issues/0521.js
Expand Up @@ -7,17 +7,12 @@ 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',
var required = readFileSync(require('path').join(__dirname, '/0521.yml'), 'utf8');
var data = {
'http://example.com/page#anchor': 'no:quotes#required',
'parameter#fallback': 'quotes #required',
'foo #bar': 'key is quoted'
'quotes: required': 'Visit [link](http://example.com/foo#bar)'
};

assert.deepEqual(
yaml.dump(sample),
yaml.dump(data)
);

var actual = yaml.safeDump(data);
assert.equal(actual, required);
});
4 changes: 2 additions & 2 deletions test/issues/0521.yml
@@ -1,3 +1,3 @@
http://example.com/page#anchor: no#quotes#required
http://example.com/page#anchor: no:quotes#required
parameter#fallback: 'quotes #required'
'foo #bar': key is quoted
'quotes: required': Visit [link](http://example.com/foo#bar)

0 comments on commit db3eb34

Please sign in to comment.