All Downloads are FREE. Search and download functionalities are using the official Maven repository.

www.reboot.components.bower_components.json5.test.stringify.js Maven / Gradle / Ivy

There is a newer version: 0.1.20
Show newest version
// tests stringify()

/*global require console exports */

// set to true to show performance stats
var DEBUG = false;

var assert = require('assert');
var JSON5 = require('../lib/json5');

// Test JSON5.stringify() by comparing its output for each case with 
// native JSON.stringify().  The only differences will be in how object keys are 
// handled.

var simpleCases = [
    null,
    9, -9, +9, +9.878,
    '', "''", '999', '9aa', 'aaa', 'aa a', 'aa\na', 'aa\\a', '\'', '\\\'', '\\"',
    undefined,
    true, false,
    {}, [], function(){},
    Date.now(), new Date(Date.now())
];

exports.stringify = {};
exports.stringify.simple = function test() {
    for (var i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy