@@ -183,9 +183,9 @@ tape('rcode', function (t) {
183183 }
184184
185185 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 ) )
189189 }
190190
191191 var buf = packet . encode ( {
@@ -245,30 +245,30 @@ tape('name_encoding', function (t) {
245245 t . end ( )
246246} )
247247
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 )
251251
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' )
254254 t . ok ( compare ( t , val , val2 ) , 'decoded object match' )
255255
256- var buf2 = packet . encode ( val2 )
257- var val3 = packet . decode ( buf2 )
256+ var buf2 = rpacket . encode ( val2 )
257+ var val3 = rpacket . decode ( buf2 )
258258
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' )
261261
262262 t . ok ( compare ( t , val , val3 ) , 'decoded object match on re-encode' )
263263 t . ok ( compare ( t , val2 , val3 ) , 're-encoded decoded object match on re-encode' )
264264
265265 var bigger = Buffer . allocUnsafe ( buf2 . length + 10 )
266266
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 )
269269
270270 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' )
272272 t . ok ( compare ( t , val , val4 ) , 'decoded object match on external buffer' )
273273}
274274
0 commit comments