From 9c8b1800b90e14b643bab6ada8e96f8f850e84a6 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 20 Oct 2010 07:22:15 -0700 Subject: fixed negative numbers in Json --- test/JsonSpec.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/JsonSpec.js') diff --git a/test/JsonSpec.js b/test/JsonSpec.js index 6fc40e09..17bb97b6 100644 --- a/test/JsonSpec.js +++ b/test/JsonSpec.js @@ -100,6 +100,10 @@ describe('json', function(){ expect(fromJson("{value:2.55, name:'misko'}")).toEqual({value:2.55, name:'misko'}); }); + it('should parse negative / possitve numbers', function() { + expect(fromJson("{neg:-2.55, pos:+.3, a:[-2, +.1, -.2, +.3]}")).toEqual({neg:-2.55, pos:+.3, a:[-2, +.1, -.2, +.3]}); + }); + describe('security', function(){ it('should not allow naked expressions', function(){ expect(function(){fromJson('1+2');}).toThrow("Did not understand '+2' while evaluating '1+2'."); -- cgit v1.2.3