@@ -65,16 +65,16 @@ b.writeDoubleBE(11.11, 0, true);
6565 buf [ 0 ] = 9 ;
6666 assert . strictEqual ( ab [ 1 ] , 9 ) ;
6767
68- assert . throws ( ( ) => Buffer . from ( ab . buffer , 6 ) , common . expectsError ( {
68+ common . expectsError ( ( ) => Buffer . from ( ab . buffer , 6 ) , {
6969 code : 'ERR_BUFFER_OUT_OF_BOUNDS' ,
7070 type : RangeError ,
7171 message : '"offset" is outside of buffer bounds'
72- } ) ) ;
73- assert . throws ( ( ) => Buffer . from ( ab . buffer , 3 , 6 ) , common . expectsError ( {
72+ } ) ;
73+ common . expectsError ( ( ) => Buffer . from ( ab . buffer , 3 , 6 ) , {
7474 code : 'ERR_BUFFER_OUT_OF_BOUNDS' ,
7575 type : RangeError ,
7676 message : '"length" is outside of buffer bounds'
77- } ) ) ;
77+ } ) ;
7878}
7979
8080// Test the deprecated Buffer() version also
@@ -93,16 +93,16 @@ b.writeDoubleBE(11.11, 0, true);
9393 buf [ 0 ] = 9 ;
9494 assert . strictEqual ( ab [ 1 ] , 9 ) ;
9595
96- assert . throws ( ( ) => Buffer ( ab . buffer , 6 ) , common . expectsError ( {
96+ common . expectsError ( ( ) => Buffer ( ab . buffer , 6 ) , {
9797 code : 'ERR_BUFFER_OUT_OF_BOUNDS' ,
9898 type : RangeError ,
9999 message : '"offset" is outside of buffer bounds'
100- } ) ) ;
101- assert . throws ( ( ) => Buffer ( ab . buffer , 3 , 6 ) , common . expectsError ( {
100+ } ) ;
101+ common . expectsError ( ( ) => Buffer ( ab . buffer , 3 , 6 ) , {
102102 code : 'ERR_BUFFER_OUT_OF_BOUNDS' ,
103103 type : RangeError ,
104104 message : '"length" is outside of buffer bounds'
105- } ) ) ;
105+ } ) ;
106106}
107107
108108{
@@ -118,13 +118,13 @@ b.writeDoubleBE(11.11, 0, true);
118118 assert . deepStrictEqual ( Buffer . from ( ab , [ 1 ] ) , Buffer . from ( ab , 1 ) ) ;
119119
120120 // If byteOffset is Infinity, throw.
121- assert . throws ( ( ) => {
121+ common . expectsError ( ( ) => {
122122 Buffer . from ( ab , Infinity ) ;
123- } , common . expectsError ( {
123+ } , {
124124 code : 'ERR_BUFFER_OUT_OF_BOUNDS' ,
125125 type : RangeError ,
126126 message : '"offset" is outside of buffer bounds'
127- } ) ) ;
127+ } ) ;
128128}
129129
130130{
@@ -140,11 +140,11 @@ b.writeDoubleBE(11.11, 0, true);
140140 assert . deepStrictEqual ( Buffer . from ( ab , 0 , [ 1 ] ) , Buffer . from ( ab , 0 , 1 ) ) ;
141141
142142 //If length is Infinity, throw.
143- assert . throws ( ( ) => {
143+ common . expectsError ( ( ) => {
144144 Buffer . from ( ab , 0 , Infinity ) ;
145- } , common . expectsError ( {
145+ } , {
146146 code : 'ERR_BUFFER_OUT_OF_BOUNDS' ,
147147 type : RangeError ,
148148 message : '"length" is outside of buffer bounds'
149- } ) ) ;
149+ } ) ;
150150}
0 commit comments