require 'spec_helper' require 'python/pickle/protocol5' require 'protocol0_read_instruction_examples' require 'protocol1_read_instruction_examples' require 'protocol2_read_instruction_examples' require 'protocol3_read_instruction_examples' require 'protocol4_read_instruction_examples' describe Python::Pickle::Protocol5 do let(:pickle) { '' } let(:io) { StringIO.new(pickle) } subject { described_class.new(io) } describe "#read_instruction" do include_context "Protocol0#read_instruction examples" include_context "Protocol1#read_instruction examples" include_context "Protocol2#read_instruction examples" include_context "Protocol3#read_instruction examples" include_context "Protocol4#read_instruction examples" describe "when the opcode is 150" do let(:bytes) { [0x41, 0x42, 0x43] } let(:string) { bytes.map(&:chr).join } let(:length) { bytes.length } let(:packed) { [length, *bytes].pack('Q