Author: kclark
Date: Tue Jun 17 18:13:58 2008
New Revision: 668985

URL: http://svn.apache.org/viewvc?rev=668985&view=rev
Log:
Add new spec for properly initializing boolean values

Modified:
    incubator/thrift/trunk/lib/rb/spec/ThriftSpec.thrift
    incubator/thrift/trunk/lib/rb/spec/gen-rb/ThriftSpec_types.rb
    incubator/thrift/trunk/lib/rb/spec/struct_spec.rb

Modified: incubator/thrift/trunk/lib/rb/spec/ThriftSpec.thrift
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/spec/ThriftSpec.thrift?rev=668985&r1=668984&r2=668985&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/spec/ThriftSpec.thrift (original)
+++ incubator/thrift/trunk/lib/rb/spec/ThriftSpec.thrift Tue Jun 17 18:13:58 
2008
@@ -12,3 +12,7 @@
   5: map<i32, map<string, double>> complex,
   6: set<i16> shorts = [5, 17, 239]
 }
+
+struct BoolStruct {
+  1: bool yesno = 1
+}

Modified: incubator/thrift/trunk/lib/rb/spec/gen-rb/ThriftSpec_types.rb
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/spec/gen-rb/ThriftSpec_types.rb?rev=668985&r1=668984&r2=668985&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/spec/gen-rb/ThriftSpec_types.rb (original)
+++ incubator/thrift/trunk/lib/rb/spec/gen-rb/ThriftSpec_types.rb Tue Jun 17 
18:13:58 2008
@@ -38,4 +38,12 @@
       }
     end
 
+    class BoolStruct
+      include Thrift::Struct
+      attr_accessor :yesno
+      FIELDS = {
+        1 => {:type => Thrift::Types::BOOL, :name => 'yesno', :default => true}
+      }
+    end
+
   end

Modified: incubator/thrift/trunk/lib/rb/spec/struct_spec.rb
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/spec/struct_spec.rb?rev=668985&r1=668984&r2=668985&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/spec/struct_spec.rb (original)
+++ incubator/thrift/trunk/lib/rb/spec/struct_spec.rb Tue Jun 17 18:13:58 2008
@@ -47,6 +47,11 @@
     end
   end
 
+  it "should properly initialize boolean values" do
+    struct = BoolStruct.new(:yesno => false)
+    struct.yesno.should be_false
+  end
+
   it "should have proper == semantics" do
     Foo.new.should_not == Hello.new
     Foo.new.should == Foo.new


Reply via email to