summaryrefslogtreecommitdiff
path: root/spec/mspec/lib/mspec/guards
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-27 16:12:18 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-27 16:12:18 +0000
commit76402dfa06db743eebfa8c8e7a13d88b44d93076 (patch)
treeb049da9405ec3b050b9d972e81f7dc43e7f1119b /spec/mspec/lib/mspec/guards
parentf8fac84c7ba232166fdacdcff026e6ea0570075b (diff)
Update to ruby/mspec@5f563e4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/mspec/lib/mspec/guards')
-rw-r--r--spec/mspec/lib/mspec/guards/platform.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/mspec/lib/mspec/guards/platform.rb b/spec/mspec/lib/mspec/guards/platform.rb
index 96176b8753..9543b1dd05 100644
--- a/spec/mspec/lib/mspec/guards/platform.rb
+++ b/spec/mspec/lib/mspec/guards/platform.rb
@@ -40,8 +40,21 @@ class PlatformGuard < SpecGuard
os?(:windows)
end
+ WORD_SIZE = 1.size * 8
+
+ POINTER_SIZE = begin
+ require 'rbconfig/sizeof'
+ RbConfig::SIZEOF["void*"] * 8
+ rescue LoadError
+ WORD_SIZE
+ end
+
def self.wordsize?(size)
- size == 8 * 1.size
+ size == WORD_SIZE
+ end
+
+ def self.pointer_size?(size)
+ size == POINTER_SIZE
end
def initialize(*args)
@@ -61,6 +74,8 @@ class PlatformGuard < SpecGuard
match &&= PlatformGuard.os?(*value)
when :wordsize
match &&= PlatformGuard.wordsize? value
+ when :pointer_size
+ match &&= PlatformGuard.pointer_size? value
end
end
match