1
0
mirror of synced 2025-12-14 18:17:59 +08:00

command line interface and updates for npm

This commit is contained in:
Zach Carter
2011-05-01 17:36:27 -04:00
parent ac7b47930b
commit 9c1023cfb1
12 changed files with 486 additions and 357 deletions

21
test/all-tests.js Normal file
View File

@@ -0,0 +1,21 @@
var fs = require("fs"),
assert = require("assert"),
parser = require("../lib/jsonlint").parser;
exports["test object"] = function () {
var json = '{"foo": "bar"}';
assert.deepEqual(parser.parse(json), {"foo": "bar"});
};
exports["test string with escaped line break"] = function () {
var json = '{"foo": "bar\\nbar"}';
assert.deepEqual(parser.parse(json), {"foo": "bar\\nbar"});
};
exports["test string with line break"] = function () {
var json = '{"foo": "bar\nbar"}';
assert["throws"](function () {parser.parse(json)}, "should throw error");
};
if (require.main === module)
require("test").run(exports);