THRIFT-312. rb: Ruby unit tests fail due to change in BinaryProtocolAccelerated interface
authorBryan Duxbury <bryanduxbury@apache.org>
Tue, 24 Mar 2009 00:08:45 +0000 (00:08 +0000)
committerBryan Duxbury <bryanduxbury@apache.org>
Tue, 24 Mar 2009 00:08:45 +0000 (00:08 +0000)
Couldn't find any broken tests anymore, but did remove some dead code that had been commented in the binary protocol spec.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757610 13f79535-47bb-0310-9956-ffa450edef68

lib/rb/spec/binaryprotocolaccelerated_spec.rb

index a2ddc55..8c10c8f 100644 (file)
@@ -14,83 +14,6 @@ class ThriftBinaryProtocolAcceleratedSpec < Spec::ExampleGroup
     def protocol_class
       BinaryProtocolAccelerated
     end
-
-#     before(:each) do
-#       @buffer = ""
-#       @trans.stub!(:borrow).and_return { @buffer }
-#       @trans.stub!(:consume!).and_return do |*args|
-#         n = args.first || 0
-#         @buffer.slice!(0,n)
-#       end
-#     end
-# 
-# 
-#     it "should raise an exception if the message header has the wrong version" do
-#       @buffer = "\000\000\000\v"
-#       # @prot.should_receive(:read_i32).and_return(42)
-#       lambda { @prot.read_message_begin }.should raise_error(Thrift::ProtocolException, 'Missing version identifier') do |e|
-#         e.type == Thrift::ProtocolException::BAD_VERSION
-#       end
-#     end
-# 
-#     it "should encode a string with null bytes in it" do
-#       foo = SpecNamespace::Hello.new(:greeting => "Hello\000World!")
-#       @prot.encode_binary(foo).should == "\v\000\001\000\000\000\fHello\000World!\000"
-#     end
-# 
-#     it "should decode a string with null bytes in it" do
-#       trans = Thrift::MemoryBuffer.new("\v\000\001\000\000\000\fHello\000World!\000")
-#       @prot.decode_binary(SpecNamespace::Hello.new, trans).should == SpecNamespace::Hello.new(:greeting => "Hello\000World!")
-#     end
-# 
-#     it "should error when encoding a struct with a nil value in a list" do
-#       Thrift.type_checking = false
-#       sl = SpecNamespace::SimpleList
-#       hello = SpecNamespace::Hello
-#       # nil counts as false for bools
-#       # lambda { @prot.encode_binary(sl.new(:bools => [true, false, nil, false])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:bytes => [1, 2, nil, 3])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:i16s => [1, 2, nil, 3])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:i32s => [1, 2, nil, 3])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:i64s => [1, 2, nil, 3])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:doubles => [1.0, 2.0, nil, 3.0])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:strings => ["one", "two", nil, "three"])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:lists => [[1, 2], nil, [3, 4]])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:maps => [{1 => 2}, nil, {3 => 4}])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:sets => [Set.new([1, 2]), nil, Set.new([3, 4])])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:structs => [hello.new, nil, hello.new(:greeting => "hi")])) }.should raise_error
-#     end
-# 
-#     it "should error when encoding a non-nil, non-correctly-typed value in a list" do
-#       Thrift.type_checking = false
-#       sl = SpecNamespace::SimpleList
-#       hello = SpecNamespace::Hello
-#       # bool should accept any value
-#       # lambda { @prot.encode_binary(sl.new(:bools => [true, false, 3])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:bytes => [1, 2, "3", 5])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:i16s => ["one", 2, 3])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:i32s => [[1,2], 3, 4])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:i64s => [{1 => 2}, 3, 4])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:doubles => ["one", 2.3, 3.4])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:strings => ["one", "two", 3, 4])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:lists => [{1 => 2}, [3, 4]])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:maps => [{1 => 2}, [3, 4]])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:sets => [Set.new([1, 2]), 3, 4])) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:structs => [3, "four"])) }.should raise_error
-#     end
-# 
-#     it "should error when encoding an improper object where a container is expected" do
-#       Thrift.type_checking = false
-#       sl = SpecNamespace::SimpleList
-#       lambda { @prot.encode_binary(sl.new(:strings => {"one" => "two", nil => "three"})) }.should raise_error
-#       lambda { @prot.encode_binary(sl.new(:maps => [[1, 2]])) }.should raise_error
-#     end
-# 
-#     it "should accept arrays and hashes as sets" do
-#       Thrift.type_checking = false
-#       sl = SpecNamespace::SimpleList
-#       lambda { @prot.encode_binary(sl.new(:sets => [[1, 2], {3 => true, 4 => true}])) }.should_not raise_error
-#     end
   end
 
   describe BinaryProtocolAcceleratedFactory do