diff options
| author | Misko Hevery | 2010-11-05 16:41:36 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2010-11-05 16:41:36 -0700 | 
| commit | d5e9f38f3de317a74f2711e93c7a5df0c89099c7 (patch) | |
| tree | 439cb74357cd6f107c4b9c93cabb09c70757b5c1 /test/JsonSpec.js | |
| parent | dc66687149078876f3964a5ab0b9aa0434f46cdc (diff) | |
| download | angular.js-d5e9f38f3de317a74f2711e93c7a5df0c89099c7.tar.bz2 | |
fix error in json parser which did not allow 1.2E10 as number
Diffstat (limited to 'test/JsonSpec.js')
| -rw-r--r-- | test/JsonSpec.js | 7 | 
1 files changed, 7 insertions, 0 deletions
| diff --git a/test/JsonSpec.js b/test/JsonSpec.js index 052c239c..e91f50cd 100644 --- a/test/JsonSpec.js +++ b/test/JsonSpec.js @@ -109,6 +109,13 @@ describe('json', function(){      expect(fromJson("{neg:-2.55, pos:+.3, a:[-2, +.1, -.2, +.3]}")).toEqual({neg:-2.55, pos:+.3, a:[-2, +.1, -.2, +.3]});    }); +  it('should parse exponents', function() { +    expect(fromJson("{exp:1.2E10}")).toEqual({exp:1.2E10}); +    expect(fromJson("{exp:1.2E-10}")).toEqual({exp:1.2E-10}); +    expect(fromJson("{exp:1.2e+10}")).toEqual({exp:1.2E10}); +    expect(fromJson("{exp:1.2e-10}")).toEqual({exp:1.2E-10}); +  }); +    describe('security', function(){      it('should not allow naked expressions', function(){        expect(function(){fromJson('1+2');}).toThrow("Did not understand '+2' while evaluating '1+2'."); | 
