diff options
author | Andrea Fazzi <andrea.fazzi@alcacoop.it> | 2009-10-05 13:16:28 +0200 |
---|---|---|
committer | Andrea Fazzi <andrea.fazzi@alcacoop.it> | 2009-10-05 13:16:28 +0200 |
commit | 919d099618685cc0304d383cb8f7aa97f179a5a0 (patch) | |
tree | d502853a0004341c61d42c61a48bba7dd58aa1f6 | |
parent | 44fc694ef931db802ad1f8995eee9508f84dc723 (diff) | |
download | ffi-919d099618685cc0304d383cb8f7aa97f179a5a0.tar.gz |
Exclude library_spec.rb examples that are specific for *nix system when running specs on windows
-rw-r--r-- | spec/ffi/library_spec.rb | 108 |
1 files changed, 56 insertions, 52 deletions
diff --git a/spec/ffi/library_spec.rb b/spec/ffi/library_spec.rb index e073953..f58a030 100644 --- a/spec/ffi/library_spec.rb +++ b/spec/ffi/library_spec.rb @@ -1,57 +1,61 @@ require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) describe "Library" do - it "attach_function with no library specified" do - lambda { - Module.new do |m| - m.extend FFI::Library - attach_function :getpid, [ ], :uint - end - }.should_not raise_error - end - it "attach_function :getpid from this process" do - lambda { - Module.new do |m| - m.extend FFI::Library - attach_function :getpid, [ ], :uint - end.getpid.should == Process.pid - }.should_not raise_error - end - it "attach_function :getpid from [ 'c', 'libc.so.6'] " do - lambda { - Module.new do |m| - m.extend FFI::Library - ffi_lib 'c', 'libc.so.6' - attach_function :getpid, [ ], :uint - end.getpid.should == Process.pid - }.should_not raise_error - end - it "attach_function :getpid from [ 'libc.so.6', 'c' ] " do - lambda { - Module.new do |m| - m.extend FFI::Library - ffi_lib 'libc.so.6', 'c' - attach_function :getpid, [ ], :uint - end.getpid.should == Process.pid - }.should_not raise_error - end - it "attach_function :getpid from [ 'libfubar.so.0xdeadbeef', nil, 'c' ] " do - lambda { - Module.new do |m| - m.extend FFI::Library - ffi_lib 'libfubar.so.0xdeadbeef', nil, 'c' - attach_function :getpid, [ ], :uint - end.getpid.should == Process.pid - }.should_not raise_error - end - it "attach_function :getpid from [ 'libfubar.so.0xdeadbeef' ] " do - lambda { - Module.new do |m| - m.extend FFI::Library - ffi_lib 'libfubar.so.0xdeadbeef' - attach_function :getpid, [ ], :uint - end.getpid.should == Process.pid - }.should raise_error(LoadError) + + unless Config::CONFIG['target_os'] =~ /mingw/ || Config::CONFIG['target_os'] =~ /win/ + it "attach_function with no library specified" do + lambda { + Module.new do |m| + m.extend FFI::Library + attach_function :getpid, [ ], :uint + end + }.should_not raise_error + end + it "attach_function :getpid from this process" do + lambda { + Module.new do |m| + m.extend FFI::Library + attach_function :getpid, [ ], :uint + end.getpid.should == Process.pid + }.should_not raise_error + end + it "attach_function :getpid from [ 'c', 'libc.so.6'] " do + lambda { + Module.new do |m| + m.extend FFI::Library + ffi_lib 'c', 'libc.so.6' + attach_function :getpid, [ ], :uint + end.getpid.should == Process.pid + }.should_not raise_error + end + it "attach_function :getpid from [ 'libc.so.6', 'c' ] " do + lambda { + Module.new do |m| + m.extend FFI::Library + ffi_lib 'libc.so.6', 'c' + attach_function :getpid, [ ], :uint + end.getpid.should == Process.pid + }.should_not raise_error + end + it "attach_function :getpid from [ 'libfubar.so.0xdeadbeef', nil, 'c' ] " do + lambda { + Module.new do |m| + m.extend FFI::Library + ffi_lib 'libfubar.so.0xdeadbeef', nil, 'c' + attach_function :getpid, [ ], :uint + end.getpid.should == Process.pid + }.should_not raise_error + end + it "attach_function :getpid from [ 'libfubar.so.0xdeadbeef' ] " do + lambda { + Module.new do |m| + m.extend FFI::Library + ffi_lib 'libfubar.so.0xdeadbeef' + attach_function :getpid, [ ], :uint + end.getpid.should == Process.pid + }.should raise_error(LoadError) + end end + def gvar_lib(name, type) Module.new do |m| m.extend FFI::Library @@ -141,4 +145,4 @@ describe "Library" do lib.gvar = val lib.get.should == val end -end
\ No newline at end of file +end |