From 17de5308d8bbdfff4595f713e8a5ffda2885a752 Mon Sep 17 00:00:00 2001 From: Himura Kazuto Date: Mon, 15 Jun 2020 15:54:36 +0300 Subject: [PATCH] Fix #521 test and add more useful cases --- test/issues/0521.js | 17 ++++++----------- test/issues/0521.yml | 4 ++-- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/test/issues/0521.js b/test/issues/0521.js index a952c184..5f78087d 100644 --- a/test/issues/0521.js +++ b/test/issues/0521.js @@ -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); }); diff --git a/test/issues/0521.yml b/test/issues/0521.yml index 38e2505e..a7108c42 100644 --- a/test/issues/0521.yml +++ b/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)