@@ -183,9 +183,9 @@ tape('rcode', function (t) {
183
183
}
184
184
185
185
const ops = [ 'QUERY' , 'IQUERY' , 'STATUS' , 'OPCODE_3' , 'NOTIFY' , 'UPDATE' , 'OPCODE_6' , 'OPCODE_7' , 'OPCODE_8' , 'OPCODE_9' , 'OPCODE_10' , 'OPCODE_11' , 'OPCODE_12' , 'OPCODE_13' , 'OPCODE_14' , 'OPCODE_15' ]
186
- for ( i in ops ) {
187
- code = opcodes . toOpcode ( ops [ i ] )
188
- t . ok ( ops [ i ] === opcodes . toString ( code ) , 'opcode conversion from/to string matches: ' + opcodes . toString ( code ) )
186
+ for ( var j in ops ) {
187
+ var ocode = opcodes . toOpcode ( ops [ j ] )
188
+ t . ok ( ops [ j ] === opcodes . toString ( ocode ) , 'opcode conversion from/to string matches: ' + opcodes . toString ( ocode ) )
189
189
}
190
190
191
191
var buf = packet . encode ( {
@@ -245,30 +245,30 @@ tape('name_encoding', function (t) {
245
245
t . end ( )
246
246
} )
247
247
248
- function testEncoder ( t , packet , val ) {
249
- var buf = packet . encode ( val )
250
- var val2 = packet . decode ( buf )
248
+ function testEncoder ( t , rpacket , val ) {
249
+ var buf = rpacket . encode ( val )
250
+ var val2 = rpacket . decode ( buf )
251
251
252
- t . same ( buf . length , packet . encode . bytes , 'encode.bytes was set correctly' )
253
- t . same ( buf . length , packet . encodingLength ( val ) , 'encoding length matches' )
252
+ t . same ( buf . length , rpacket . encode . bytes , 'encode.bytes was set correctly' )
253
+ t . same ( buf . length , rpacket . encodingLength ( val ) , 'encoding length matches' )
254
254
t . ok ( compare ( t , val , val2 ) , 'decoded object match' )
255
255
256
- var buf2 = packet . encode ( val2 )
257
- var val3 = packet . decode ( buf2 )
256
+ var buf2 = rpacket . encode ( val2 )
257
+ var val3 = rpacket . decode ( buf2 )
258
258
259
- t . same ( buf2 . length , packet . encode . bytes , 'encode.bytes was set correctly on re-encode' )
260
- t . same ( buf2 . length , packet . encodingLength ( val ) , 'encoding length matches on re-encode' )
259
+ t . same ( buf2 . length , rpacket . encode . bytes , 'encode.bytes was set correctly on re-encode' )
260
+ t . same ( buf2 . length , rpacket . encodingLength ( val ) , 'encoding length matches on re-encode' )
261
261
262
262
t . ok ( compare ( t , val , val3 ) , 'decoded object match on re-encode' )
263
263
t . ok ( compare ( t , val2 , val3 ) , 're-encoded decoded object match on re-encode' )
264
264
265
265
var bigger = Buffer . allocUnsafe ( buf2 . length + 10 )
266
266
267
- var buf3 = packet . encode ( val , bigger , 10 )
268
- var val4 = packet . decode ( buf3 , 10 )
267
+ var buf3 = rpacket . encode ( val , bigger , 10 )
268
+ var val4 = rpacket . decode ( buf3 , 10 )
269
269
270
270
t . ok ( buf3 === bigger , 'echoes buffer on external buffer' )
271
- t . same ( packet . encode . bytes , buf . length , 'encode.bytes is the same on external buffer' )
271
+ t . same ( rpacket . encode . bytes , buf . length , 'encode.bytes is the same on external buffer' )
272
272
t . ok ( compare ( t , val , val4 ) , 'decoded object match on external buffer' )
273
273
}
274
274
0 commit comments