summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortduehr <tduehr@gmail.com>2015-05-21 09:17:18 -0500
committertduehr <tduehr@gmail.com>2015-05-21 09:17:18 -0500
commitf2e25402359dc6a8f6fa0039bdae579fb0ac9910 (patch)
treead5d46c2d37e84665d831edf5526fefacbea742a
parentd9db892b99b55449621acf1525a5e6ede06b7aff (diff)
downloadffi-f2e25402359dc6a8f6fa0039bdae579fb0ac9910.tar.gz
enable and fix warnings in specs
-rw-r--r--Gemfile2
-rw-r--r--Rakefile28
-rw-r--r--spec/ffi/rbx/attach_function_spec.rb2
-rw-r--r--spec/ffi/spec_helper.rb8
-rw-r--r--spec/ffi/struct_spec.rb2
-rw-r--r--spec/spec.opts1
6 files changed, 11 insertions, 32 deletions
diff --git a/Gemfile b/Gemfile
index d27a1b2..213ea1d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
group :development do
gem 'rake', '~> 10.1'
gem 'rake-compiler', '~> 0.9.5'
- gem 'rspec', '~> 2.14.1'
+ gem 'rspec', '~> 3.0'
gem 'rubygems-tasks', '~> 0.2.4', :require => 'rubygems/tasks'
gem "rubysl", "~> 2.0", :platforms => 'rbx'
end
diff --git a/Rakefile b/Rakefile
index 0dfdebb..3aa7a75 100644
--- a/Rakefile
+++ b/Rakefile
@@ -13,11 +13,6 @@ require 'rbconfig'
require 'rspec/core/rake_task'
require 'rubygems/package_task'
-RSpec::Core::RakeTask.new(:spec => :compile) do |config|
- config.rspec_opts = YAML.load_file 'spec/spec.opts'
-end
-
-
LIBEXT = case RbConfig::CONFIG['host_os'].downcase
when /darwin/
"dylib"
@@ -81,26 +76,15 @@ end
TEST_DEPS = [ LIBTEST ]
if RUBY_PLATFORM == "java"
- desc "Run all specs"
- task :specs, [:options] => TEST_DEPS do |t, args|
- sh %{#{Gem.ruby} -w -S rspec #{args.options || Dir["spec/ffi/*_spec.rb"].join(" ")} -fs --color}
- end
- desc "Run rubinius specs"
- task :rbxspecs => TEST_DEPS do
- sh %{#{Gem.ruby} -w -S rspec #{Dir["spec/ffi/rbx/*_spec.rb"].join(" ")} -fs --color}
+ RSpec::Core::RakeTask.new(:spec) do |config|
+ config.rspec_opts = YAML.load_file 'spec/spec.opts'
end
else
- TEST_DEPS.unshift :compile
- desc "Run all specs"
- task :specs, [:options] => TEST_DEPS do |t, args|
- ENV["MRI_FFI"] = "1"
- sh %{#{Gem.ruby} -w -Ilib -I#{BUILD_EXT_DIR} -S rspec #{args.options || Dir["spec/ffi/*_spec.rb"].join(" ")} -fs --color}
- end
- desc "Run rubinius specs"
- task :rbxspecs => TEST_DEPS do
- ENV["MRI_FFI"] = "1"
- sh %{#{Gem.ruby} -w -Ilib -I#{BUILD_EXT_DIR} -S rspec #{Dir["spec/ffi/rbx/*_spec.rb"].join(" ")} -fs --color}
+ RSpec::Core::RakeTask.new(:spec => :compile) do |config|
+ config.rspec_opts = YAML.load_file 'spec/spec.opts'
end
+
+ TEST_DEPS.unshift :compile
end
desc "Build all packages"
diff --git a/spec/ffi/rbx/attach_function_spec.rb b/spec/ffi/rbx/attach_function_spec.rb
index 1ab880e..e90f535 100644
--- a/spec/ffi/rbx/attach_function_spec.rb
+++ b/spec/ffi/rbx/attach_function_spec.rb
@@ -25,7 +25,7 @@ describe FFI::Library, "#attach_function" do
it "correctly populates a struct for gettimeofday" do
t = Timeval.new
- time = LibC.gettimeofday(t.pointer, nil)
+ LibC.gettimeofday(t.pointer, nil)
expect(t[:tv_sec]).to be_kind_of(Numeric)
expect(t[:tv_usec]).to be_kind_of(Numeric)
end
diff --git a/spec/ffi/spec_helper.rb b/spec/ffi/spec_helper.rb
index 00c43ec..88d269e 100644
--- a/spec/ffi/spec_helper.rb
+++ b/spec/ffi/spec_helper.rb
@@ -53,13 +53,7 @@ def compile_library(path, lib)
dir = File.expand_path(path, File.dirname(__FILE__))
lib = "#{dir}/#{lib}"
- if !File.exists?(lib)
- ldshared = RbConfig::CONFIG["LDSHARED"] || "clang -dynamic -bundle"
- libs = RbConfig::CONFIG["LIBS"]
- dldflags = RbConfig::CONFIG["DLDFLAGS"] || "-Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress"
-
- puts Dir.pwd, dir, File.dirname(__FILE__)
-
+ if !File.exist?(lib)
output = nil
FileUtils.cd(dir) do
output = system(*%{#{system('which gmake >/dev/null') && 'gmake' || 'make'} CPU=#{CPU} OS=#{OS} }.tap{|x| puts x.inspect})
diff --git a/spec/ffi/struct_spec.rb b/spec/ffi/struct_spec.rb
index 9cb08bc..6c03277 100644
--- a/spec/ffi/struct_spec.rb
+++ b/spec/ffi/struct_spec.rb
@@ -102,7 +102,7 @@ describe "Struct tests" do
smp = FFI::MemoryPointer.new :pointer
s = PointerMember.new smp
expect { s[:pointer] = s }.not_to raise_error Exception
- expect { foo = s[:pointer] }.not_to raise_error Exception
+ expect { s[:pointer].nil? }.not_to raise_error Exception
end
it "Struct#[:pointer]=nil" do
diff --git a/spec/spec.opts b/spec/spec.opts
index 4cc9a8a..60a0245 100644
--- a/spec/spec.opts
+++ b/spec/spec.opts
@@ -1,3 +1,4 @@
--color
+-w
--format
documentation