@@ -65,16 +65,16 @@ b.writeDoubleBE(11.11, 0, true);
65
65
buf [ 0 ] = 9 ;
66
66
assert . strictEqual ( ab [ 1 ] , 9 ) ;
67
67
68
- assert . throws ( ( ) => Buffer . from ( ab . buffer , 6 ) , common . expectsError ( {
68
+ common . expectsError ( ( ) => Buffer . from ( ab . buffer , 6 ) , {
69
69
code : 'ERR_BUFFER_OUT_OF_BOUNDS' ,
70
70
type : RangeError ,
71
71
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 ) , {
74
74
code : 'ERR_BUFFER_OUT_OF_BOUNDS' ,
75
75
type : RangeError ,
76
76
message : '"length" is outside of buffer bounds'
77
- } ) ) ;
77
+ } ) ;
78
78
}
79
79
80
80
// Test the deprecated Buffer() version also
@@ -93,16 +93,16 @@ b.writeDoubleBE(11.11, 0, true);
93
93
buf [ 0 ] = 9 ;
94
94
assert . strictEqual ( ab [ 1 ] , 9 ) ;
95
95
96
- assert . throws ( ( ) => Buffer ( ab . buffer , 6 ) , common . expectsError ( {
96
+ common . expectsError ( ( ) => Buffer ( ab . buffer , 6 ) , {
97
97
code : 'ERR_BUFFER_OUT_OF_BOUNDS' ,
98
98
type : RangeError ,
99
99
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 ) , {
102
102
code : 'ERR_BUFFER_OUT_OF_BOUNDS' ,
103
103
type : RangeError ,
104
104
message : '"length" is outside of buffer bounds'
105
- } ) ) ;
105
+ } ) ;
106
106
}
107
107
108
108
{
@@ -118,13 +118,13 @@ b.writeDoubleBE(11.11, 0, true);
118
118
assert . deepStrictEqual ( Buffer . from ( ab , [ 1 ] ) , Buffer . from ( ab , 1 ) ) ;
119
119
120
120
// If byteOffset is Infinity, throw.
121
- assert . throws ( ( ) => {
121
+ common . expectsError ( ( ) => {
122
122
Buffer . from ( ab , Infinity ) ;
123
- } , common . expectsError ( {
123
+ } , {
124
124
code : 'ERR_BUFFER_OUT_OF_BOUNDS' ,
125
125
type : RangeError ,
126
126
message : '"offset" is outside of buffer bounds'
127
- } ) ) ;
127
+ } ) ;
128
128
}
129
129
130
130
{
@@ -140,11 +140,11 @@ b.writeDoubleBE(11.11, 0, true);
140
140
assert . deepStrictEqual ( Buffer . from ( ab , 0 , [ 1 ] ) , Buffer . from ( ab , 0 , 1 ) ) ;
141
141
142
142
//If length is Infinity, throw.
143
- assert . throws ( ( ) => {
143
+ common . expectsError ( ( ) => {
144
144
Buffer . from ( ab , 0 , Infinity ) ;
145
- } , common . expectsError ( {
145
+ } , {
146
146
code : 'ERR_BUFFER_OUT_OF_BOUNDS' ,
147
147
type : RangeError ,
148
148
message : '"length" is outside of buffer bounds'
149
- } ) ) ;
149
+ } ) ;
150
150
}
0 commit comments