Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 7673b2a

Browse files
committed
added more tests for json float
1 parent 9b392ec commit 7673b2a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

test/JsonTest.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,7 @@ JsonTest.prototype.testItShouldSerializeSameObjectsMultipleTimes = function () {
8282
JsonTest.prototype.testItShouldNotSerializeUndefinedValues = function () {
8383
assertEquals('{}', angular.toJson({A:undefined}));
8484
};
85+
86+
JsonTest.prototype.testItShouldParseFloats = function () {
87+
expect(fromJson("{value:2.55, name:'misko'}")).toEqual({value:2.55, name:'misko'});
88+
};

test/ParserTest.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ LexerTest.prototype.testStatements = function(){
147147
assertEquals(tokens[3].text, ';');
148148
};
149149

150+
LexerTest.prototype.testNumber = function(){
151+
var tokens = new Lexer("0.5").parse();
152+
expect(tokens[0].text).toEqual(0.5);
153+
};
154+
150155
ParserTest = TestCase('ParserTest');
151156

152157
ParserTest.prototype.testExpressions = function(){

0 commit comments

Comments
 (0)