summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortduehr <tduehr@gmail.com>2014-09-26 08:49:10 -0500
committertduehr <tduehr@gmail.com>2014-09-26 08:49:10 -0500
commitf3f3797f5616f399a9b1dd8e2e02ad204210b2f1 (patch)
tree2b39dbd8c0fe16675a532cd9cd730e154850d7d4
parent319d00c2a9cd542cb2419e557721e271e769abbe (diff)
downloadffi-f3f3797f5616f399a9b1dd8e2e02ad204210b2f1.tar.gz
add spec from jruby issue
-rw-r--r--spec/ffi/library_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/ffi/library_spec.rb b/spec/ffi/library_spec.rb
index 9de1684..6fa7329 100644
--- a/spec/ffi/library_spec.rb
+++ b/spec/ffi/library_spec.rb
@@ -7,6 +7,22 @@ require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
require 'ffi'
describe "Library" do
+ describe ".enum_value" do
+ m = Module.new do
+ extend FFI::Library
+ enum :something, [:one, :two]
+ end
+
+ it "should return a value for a valid key" do
+ m.enum_value(:one).should == 0
+ m.enum_value(:two).should == 1
+ end
+
+ it "should return nil for an invalid key" do
+ m.enum_value(:three).should == nil
+ end
+ end
+
describe "#ffi_convention" do
it "defaults to :default" do
m = Module.new do