mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 10:48:51 +00:00
Add new spec for properly initializing boolean values
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668985 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a7613dde90
commit
1cfd693f3e
@ -12,3 +12,7 @@ struct Foo {
|
||||
5: map<i32, map<string, double>> complex,
|
||||
6: set<i16> shorts = [5, 17, 239]
|
||||
}
|
||||
|
||||
struct BoolStruct {
|
||||
1: bool yesno = 1
|
||||
}
|
||||
|
@ -38,4 +38,12 @@ module SpecNamespace
|
||||
}
|
||||
end
|
||||
|
||||
class BoolStruct
|
||||
include Thrift::Struct
|
||||
attr_accessor :yesno
|
||||
FIELDS = {
|
||||
1 => {:type => Thrift::Types::BOOL, :name => 'yesno', :default => true}
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -47,6 +47,11 @@ class ThriftStructSpec < Spec::ExampleGroup
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user