@@ -150,20 +150,24 @@ describe('hessian v1', function () {
150
150
[ 1.111 , '<Buffer 44 3f f1 c6 a7 ef 9d b2 2d>' ] ,
151
151
// 1e320
152
152
[ Infinity , '<Buffer 44 7f f0 00 00 00 00 00 00>' ] ,
153
+ [ - Infinity , '<Buffer 44 ff f0 00 00 00 00 00 00>' ] ,
153
154
] ;
154
155
155
156
tests . forEach ( function ( t ) {
156
157
var buf = encoder . writeDouble ( t [ 0 ] ) . get ( ) ;
157
- assert ( buf . inspect ( ) === t [ 1 ] ) ;
158
- assert ( decoder . init ( buf ) . readDouble ( ) === t [ 0 ] ) ;
158
+ assert . equal ( buf . inspect ( ) , t [ 1 ] ) ;
159
+ assert . equal ( decoder . init ( buf ) . readDouble ( ) , t [ 0 ] ) ;
159
160
encoder . clean ( ) ;
160
161
decoder . clean ( ) ;
161
162
} ) ;
163
+ const negativeInfinityBuffer = encoder . writeDouble ( - Infinity ) . get ( ) ;
164
+ const v = decoder . init ( negativeInfinityBuffer ) . readDouble ( ) ;
165
+ assert . equal ( JSON . stringify ( { v } ) , '{"v":null}' ) ;
162
166
} ) ;
163
167
164
168
it ( 'should read double error' , function ( ) {
165
169
var tests = [
166
- [ new Buffer ( [ 0x45 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ] ) ,
170
+ [ Buffer . from ( [ 0x45 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ] ) ,
167
171
'hessian readDouble only accept label `D` but got unexpect label `E`' ]
168
172
] ;
169
173
tests . forEach ( function ( t ) {
0 commit comments