]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/pretty-json/node_modules/json-stable-stringify/test/space.js
1 var test
= require('tape');
2 var stringify
= require('../');
4 test('space parameter', function (t
) {
6 var obj
= { one: 1, two: 2 };
7 t
.equal(stringify(obj
, {space: ' '}), ''
15 test('space parameter (with tabs)', function (t
) {
17 var obj
= { one: 1, two: 2 };
18 t
.equal(stringify(obj
, {space: '\t'}), ''
26 test('space parameter (with a number)', function (t
) {
28 var obj
= { one: 1, two: 2 };
29 t
.equal(stringify(obj
, {space: 3}), ''
37 test('space parameter (nested objects)', function (t
) {
39 var obj
= { one: 1, two: { b: 4, a: [2,3] } };
40 t
.equal(stringify(obj
, {space: ' '}), ''
54 test('space parameter (same as native)', function (t
) {
56 // for this test, properties need to be in alphabetical order
57 var obj
= { one: 1, two: { a: [2,3], b: 4 } };
58 t
.equal(stringify(obj
, {space: ' '}), JSON
.stringify(obj
, null, ' '));