-
-
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.
Disallow completely empty nodes in flow collections
fix #321
- Loading branch information
Showing
3 changed files
with
24 additions
and
0 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
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,19 @@ | ||
'use strict'; | ||
|
||
|
||
const assert = require('assert'); | ||
const yaml = require('../../'); | ||
|
||
|
||
it('Should throw exception on extra comma in flow mappings', function () { | ||
assert.throws(function () { | ||
yaml.load('[foo, bar,, baz]'); | ||
}, /expected the node content, but found ','/); | ||
|
||
assert.throws(function () { | ||
yaml.load('{foo, bar,, baz}'); | ||
}, /expected the node content, but found ','/); | ||
|
||
// empty key is allowed here | ||
assert.deepStrictEqual(yaml.load('{foo,: bar}'), { foo: null, null: 'bar' }); | ||
}); |