diff options
author | postmodern <postmodern.mod3@gmail.com> | 2009-11-27 08:06:28 -0800 |
---|---|---|
committer | Wayne Meissner <wmeissner@gmail.com> | 2009-11-28 05:44:33 +1000 |
commit | 2383bb405a791ee3d0107d19d8ea32b919e20f58 (patch) | |
tree | 4a7099c71934e7b12ee5c04fc4395adbd1cb0324 | |
parent | cc5e2de3977f00b635fb5f0982a613d56193f47f (diff) | |
download | ffi-2383bb405a791ee3d0107d19d8ea32b919e20f58.tar.gz |
Made the :enum field-type Struct spec more robust by checking the underlying value of the enum value.
-rw-r--r-- | spec/ffi/struct_spec.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/spec/ffi/struct_spec.rb b/spec/ffi/struct_spec.rb index 531d9f7..a9c333d 100644 --- a/spec/ffi/struct_spec.rb +++ b/spec/ffi/struct_spec.rb @@ -288,15 +288,17 @@ describe "Struct tests" do end module EnumFields extend FFI::Library - enum :test_enum, [:c1, :c2, :c3, :c4, :c5, :c6] + enum :test_enum, [:c1, 10, :c2, 20, :c3, 30, :c4, 40] class TestStruct < FFI::Struct layout :c, :test_enum end end it ":enum field r/w" do s = EnumFields::TestStruct.new - s[:c] = :c6 - s[:c].should == :c6 + s[:c] = :c3 + + s.pointer.get_uint(0).should == 30 + s[:c].should == :c3 end module CallbackMember extend FFI::Library |