forked from nodeca/js-yaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dumper: fix negative integers in bin/octal/hex formats, close nodeca#399
- Loading branch information
Vitaly Puzrin
committed
Mar 5, 2018
1 parent
c62fd62
commit dc2227b
Showing
2 changed files
with
24 additions
and
4 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,19 @@ | ||
'use strict'; | ||
|
||
|
||
var assert = require('assert'); | ||
var yaml = require('../../'); | ||
|
||
|
||
test('should properly dump negative ints in different styles', function () { | ||
var dump, src = { integer: -100 }; | ||
|
||
dump = yaml.dump(src, { styles: { '!!int': 'binary' } }); | ||
assert.deepEqual(yaml.safeLoad(dump), src); | ||
|
||
dump = yaml.dump(src, { styles: { '!!int': 'octal' } }); | ||
assert.deepEqual(yaml.safeLoad(dump), src); | ||
|
||
dump = yaml.dump(src, { styles: { '!!int': 'hex' } }); | ||
assert.deepEqual(yaml.safeLoad(dump), src); | ||
}); |