rb: Add pretty inspect, optional field hint for Thrift::Struct
Author: Bryan Duxbury
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@689193 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/rb/spec/struct_spec.rb b/lib/rb/spec/struct_spec.rb
index 8e83d47..7c52d16 100644
--- a/lib/rb/spec/struct_spec.rb
+++ b/lib/rb/spec/struct_spec.rb
@@ -17,14 +17,15 @@
describe Struct do
it "should iterate over all fields properly" do
fields = {}
- Foo.new.each_field { |fid,type,name,default| fields[fid] = [type,name,default] }
+ Foo.new.each_field { |fid,type,name,default,optional| fields[fid] = [type,name,default,optional] }
fields.should == {
- 1 => [Types::I32, 'simple', 53],
- 2 => [Types::STRING, 'words', "words"],
- 3 => [Types::STRUCT, 'hello', Hello.new(:greeting => 'hello, world!')],
- 4 => [Types::LIST, 'ints', [1, 2, 2, 3]],
- 5 => [Types::MAP, 'complex', nil],
- 6 => [Types::SET, 'shorts', Set.new([5, 17, 239])]
+ 1 => [Types::I32, 'simple', 53, nil],
+ 2 => [Types::STRING, 'words', "words", nil],
+ 3 => [Types::STRUCT, 'hello', Hello.new(:greeting => 'hello, world!'), nil],
+ 4 => [Types::LIST, 'ints', [1, 2, 2, 3], nil],
+ 5 => [Types::MAP, 'complex', nil, nil],
+ 6 => [Types::SET, 'shorts', Set.new([5, 17, 239]), nil],
+ 7 => [Types::STRING, 'opt_string', nil, true]
}
end