Author: kclark
Date: Tue Jun 17 18:12:48 2008
New Revision: 668978
URL: http://svn.apache.org/viewvc?rev=668978&view=rev
Log:
Test BinaryProtocol#read_message_header with bad data
Modified:
incubator/thrift/trunk/lib/rb/spec/binaryprotocol_spec.rb
Modified: incubator/thrift/trunk/lib/rb/spec/binaryprotocol_spec.rb
URL:
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/spec/binaryprotocol_spec.rb?rev=668978&r1=668977&r2=668978&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/spec/binaryprotocol_spec.rb (original)
+++ incubator/thrift/trunk/lib/rb/spec/binaryprotocol_spec.rb Tue Jun 17
18:12:48 2008
@@ -175,7 +175,12 @@
@prot.read_message_begin.should == ['testMessage', MessageTypes::REPLY,
42]
end
- # message header is a noop
+ it "should raise an exception if the message header has the wrong version"
do
+ @prot.should_receive(:read_i32).and_return(42)
+ lambda { @prot.read_message_begin }.should
raise_error(ProtocolException, 'Missing version identifier') { |e| e.type ==
ProtocolException::BAD_VERSION }
+ end
+
+ # message footer is a noop
it "should read a field header" do
@prot.should_receive(:read_byte).ordered.and_return(Types::STRING)