summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/rubyspec/library/date/next_day_spec.rb10
-rw-r--r--spec/rubyspec/library/set/case_equality_spec.rb6
-rw-r--r--spec/rubyspec/library/set/sortedset/case_equality_spec.rb6
-rw-r--r--spec/rubyspec/optional/capi/ext/st_spec.c7
-rw-r--r--spec/rubyspec/optional/capi/spec_helper.rb44
5 files changed, 48 insertions, 25 deletions
diff --git a/spec/rubyspec/library/date/next_day_spec.rb b/spec/rubyspec/library/date/next_day_spec.rb
new file mode 100644
index 0000000000..1ccb4df257
--- /dev/null
+++ b/spec/rubyspec/library/date/next_day_spec.rb
@@ -0,0 +1,10 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+require 'date'
+
+describe "Date#next_day" do
+ it "returns the next day" do
+ d = Date.new(2000, 1, 5)
+ d1 = Date.new(2000, 1, 4).next_day
+ d1.should == d
+ end
+end
diff --git a/spec/rubyspec/library/set/case_equality_spec.rb b/spec/rubyspec/library/set/case_equality_spec.rb
index ca1e900557..f256324d49 100644
--- a/spec/rubyspec/library/set/case_equality_spec.rb
+++ b/spec/rubyspec/library/set/case_equality_spec.rb
@@ -2,6 +2,8 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/include', __FILE__)
require 'set'
-describe "Set#===" do
- it_behaves_like :set_include, :===
+ruby_version_is "2.5" do
+ describe "Set#===" do
+ it_behaves_like :set_include, :===
+ end
end
diff --git a/spec/rubyspec/library/set/sortedset/case_equality_spec.rb b/spec/rubyspec/library/set/sortedset/case_equality_spec.rb
index f5ff2c91fe..cea52dedbd 100644
--- a/spec/rubyspec/library/set/sortedset/case_equality_spec.rb
+++ b/spec/rubyspec/library/set/sortedset/case_equality_spec.rb
@@ -2,6 +2,8 @@ require File.expand_path('../../../../spec_helper', __FILE__)
require File.expand_path('../shared/include', __FILE__)
require 'set'
-describe "SortedSet#===" do
- it_behaves_like :sorted_set_include, :===
+ruby_version_is "2.5" do
+ describe "SortedSet#===" do
+ it_behaves_like :sorted_set_include, :===
+ end
end
diff --git a/spec/rubyspec/optional/capi/ext/st_spec.c b/spec/rubyspec/optional/capi/ext/st_spec.c
index f743a4396f..4e59698d77 100644
--- a/spec/rubyspec/optional/capi/ext/st_spec.c
+++ b/spec/rubyspec/optional/capi/ext/st_spec.c
@@ -13,10 +13,11 @@ extern "C" {
#endif
#ifdef HAVE_RB_ST
-# if SIZEOF_LONG == SIZEOF_VOIDP
-# define ST2NUM(x) ULONG2NUM(x)
+
+#if SIZEOF_LONG == SIZEOF_VOIDP
+# define ST2NUM(x) ULONG2NUM(x)
#else
-# define ST2NUM(x) ULL2NUM(x)
+# define ST2NUM(x) ULL2NUM(x)
#endif
VALUE st_spec_st_init_numtable(VALUE self) {
diff --git a/spec/rubyspec/optional/capi/spec_helper.rb b/spec/rubyspec/optional/capi/spec_helper.rb
index b82ce69b0e..21d2cd04c5 100644
--- a/spec/rubyspec/optional/capi/spec_helper.rb
+++ b/spec/rubyspec/optional/capi/spec_helper.rb
@@ -55,25 +55,8 @@ def compile_extension(name)
$stderr.puts output if debug
end
- make = ENV['MAKE']
- make ||= (RbConfig::CONFIG['host_os'].include?("mswin") ? "nmake" : "make")
- if File.basename(make, ".*").casecmp?("nmake")
- # suppress logo of nmake.exe to stderr
- ENV["MAKEFLAGS"] = "l#{ENV["MAKEFLAGS"]}"
- end
-
- opts = {}
- if /(?:\A|\s)--jobserver-(?:auth|fds)=(\d+),(\d+)/ =~ ENV["MAKEFLAGS"]
- begin
- r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
- w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
- rescue Errno::EBADF
- else
- opts[r] = r
- opts[w] = w
- end
- end
# Do not capture stderr as we want to show compiler warnings
+ make, opts = setup_make
output = IO.popen([make, "V=1", "DESTDIR=", opts], &:read)
raise "#{make} failed:\n#{output}" unless $?.success?
$stderr.puts output if debug
@@ -88,6 +71,31 @@ def compile_extension(name)
lib
end
+def setup_make
+ make = ENV['MAKE']
+ make ||= (RbConfig::CONFIG['host_os'].include?("mswin") ? "nmake" : "make")
+ make_flags = ENV["MAKEFLAGS"] || ''
+
+ # suppress logo of nmake.exe to stderr
+ if File.basename(make, ".*").downcase == "nmake" and !make_flags.include?("l")
+ ENV["MAKEFLAGS"] = "l#{make_flags}"
+ end
+
+ opts = {}
+ if /(?:\A|\s)--jobserver-(?:auth|fds)=(\d+),(\d+)/ =~ make_flags
+ begin
+ r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
+ w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
+ rescue Errno::EBADF
+ else
+ opts[r] = r
+ opts[w] = w
+ end
+ end
+
+ [make, opts]
+end
+
def load_extension(name)
require compile_extension(name)
rescue LoadError