Author: kclark
Date: Tue Jun 17 18:13:18 2008
New Revision: 668981
URL: http://svn.apache.org/viewvc?rev=668981&view=rev
Log:
Add two missing tests for FramedTransport
Modified:
incubator/thrift/trunk/lib/rb/spec/transport_spec.rb
Modified: incubator/thrift/trunk/lib/rb/spec/transport_spec.rb
URL:
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/spec/transport_spec.rb?rev=668981&r1=668980&r2=668981&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/spec/transport_spec.rb (original)
+++ incubator/thrift/trunk/lib/rb/spec/transport_spec.rb Tue Jun 17 18:13:18
2008
@@ -137,6 +137,10 @@
ftrans.read(16).should == "a frame"
end
+ it "should return nothing if asked for <= 0" do
+ FramedTransport.new(@trans).read(-2).should == ""
+ end
+
it "should pull a new frame when the first is exhausted" do
frame = "this is a frame"
frame2 = "yet another frame"
@@ -159,6 +163,15 @@
ftrans.write("this is a frame")
end
+ it "should write slices of the buffer" do
+ ftrans = FramedTransport.new(@trans)
+ ftrans.write("foobar", 3)
+ ftrans.write("barfoo", 1)
+ @trans.stub!(:flush)
+ @trans.should_receive(:write).with("\000\000\000\004foob")
+ ftrans.flush
+ end
+
it "should flush frames with a 4-byte header" do
ftrans = FramedTransport.new(@trans)
@trans.should_receive(:write).with("\000\000\000\035one/two/three/this
is a frame").ordered