-
-
Notifications
You must be signed in to change notification settings - Fork 775
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error with anchor not being assigned to an empty node
fix #301
- Loading branch information
Showing
3 changed files
with
77 additions
and
45 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,28 @@ | ||
'use strict'; | ||
|
||
|
||
const assert = require('assert'); | ||
const yaml = require('../../'); | ||
|
||
|
||
it('should assign anchor to an empty node', function () { | ||
assert.deepStrictEqual( | ||
yaml.load('foo: &a\nbar: *a\n'), | ||
{ foo: null, bar: null } | ||
); | ||
|
||
assert.deepStrictEqual( | ||
yaml.load('{ foo: &a, bar: *a }'), | ||
{ foo: null, bar: null } | ||
); | ||
|
||
assert.deepStrictEqual( | ||
yaml.load('- &a\n- *a\n'), | ||
[ null, null ] | ||
); | ||
|
||
assert.deepStrictEqual( | ||
yaml.load('[ &a, *a ]'), | ||
[ null, null ] | ||
); | ||
}); |