@@ -632,6 +632,38 @@ describe('parser', function() {
632
632
expect ( scope . a ) . not . toBeDefined ( ) ;
633
633
} ) ;
634
634
635
+ it ( 'should evaluate Infinity' , function ( ) {
636
+ expect ( scope . $eval ( "Infinity" ) ) . toBe ( Infinity ) ;
637
+ expect ( scope . $eval ( "a=Infinity" ) ) . toBe ( Infinity ) ;
638
+ expect ( scope . a ) . toBe ( Infinity ) ;
639
+ } ) ;
640
+
641
+ it ( 'should evaluate -Infinity' , function ( ) {
642
+ expect ( scope . $eval ( "-Infinity" ) ) . toBe ( - Infinity ) ;
643
+ expect ( scope . $eval ( "a=-Infinity" ) ) . toBe ( - Infinity ) ;
644
+ expect ( scope . a ) . toBe ( - Infinity ) ;
645
+ } ) ;
646
+
647
+ it ( 'should dereference object properties named "Infinity"' , function ( ) {
648
+ scope . obj = { 'Infinity' : 42 } ;
649
+ expect ( scope . $eval ( "obj.Infinity" ) ) . toBe ( 42 ) ;
650
+ expect ( scope . $eval ( "obj.Infinity = 43" ) ) . toBe ( 43 ) ;
651
+ expect ( scope . obj . Infinity ) . toBe ( 43 ) ;
652
+ } ) ;
653
+
654
+ it ( 'should evaluate NaN' , function ( ) {
655
+ expect ( scope . $eval ( "NaN" ) ) . toBeNaN ( ) ;
656
+ expect ( scope . $eval ( "a=NaN" ) ) . toBeNaN ( ) ;
657
+ expect ( scope . a ) . toBeNaN ( ) ;
658
+ } ) ;
659
+
660
+ it ( 'should dereference object properties named "NaN"' , function ( ) {
661
+ scope . obj = { 'NaN' : 42 } ;
662
+ expect ( scope . $eval ( "obj.NaN" ) ) . toBe ( 42 ) ;
663
+ expect ( scope . $eval ( "obj.NaN = 43" ) ) . toBe ( 43 ) ;
664
+ expect ( scope . obj . NaN ) . toBe ( 43 ) ;
665
+ } ) ;
666
+
635
667
it ( 'should allow assignment after array dereference' , function ( ) {
636
668
scope . obj = [ { } ] ;
637
669
scope . $eval ( 'obj[0].name=1' ) ;
0 commit comments