test/common.rb in net-sftp-2.1.1 vs test/common.rb in net-sftp-2.1.2
- old
+ new
@@ -123,9 +123,21 @@
class Net::SSH::Test::Channel
def gets_packet(type, *args)
gets_data(sftp_packet(type, *args))
end
+ def gets_packet_in_two(fragment_len, type, *args)
+ fragment_len ||= 0
+ whole_packet = sftp_packet(type, *args)
+
+ if 0 < fragment_len && fragment_len < whole_packet.length
+ gets_data(whole_packet[0, whole_packet.length - fragment_len])
+ gets_data(whole_packet[-fragment_len..-1])
+ else
+ gets_data(whole_packet)
+ end
+ end
+
def sends_packet(type, *args)
sends_data(sftp_packet(type, *args))
end
private