This commit is contained in:
Benoit Daloze 2020-12-27 17:35:30 +01:00
parent a042043487
commit 267bed0cd9
4 changed files with 16 additions and 15 deletions

View File

@ -53,7 +53,7 @@ To install the gem dependencies with Bundler, run the following:
ruby -S bundle install ruby -S bundle install
``` ```
## Running Specs ## Development
Use RSpec to run the MSpec specs. There are no plans currently to make the Use RSpec to run the MSpec specs. There are no plans currently to make the
MSpec specs runnable by MSpec: https://github.com/ruby/mspec/issues/19. MSpec specs runnable by MSpec: https://github.com/ruby/mspec/issues/19.

View File

@ -38,9 +38,7 @@ class MSpecScript
end end
def initialize def initialize
ruby_version_is ""..."2.5" do check_version!
abort "MSpec needs Ruby 2.5 or more recent"
end
config[:formatter] = nil config[:formatter] = nil
config[:includes] = [] config[:includes] = []
@ -280,4 +278,10 @@ class MSpecScript
require 'mspec' require 'mspec'
script.run script.run
end end
private def check_version!
ruby_version_is ""..."2.5" do
warn "MSpec is supported for Ruby 2.5 and above only"
end
end
end end

View File

@ -1,9 +1,12 @@
require 'mspec/guards/version' require 'mspec/guards/version'
# Always enable deprecation warnings when running MSpec, as ruby/spec tests for them, # Always enable deprecation warnings when running MSpec, as ruby/spec tests for them,
# and like in most test frameworks, all warnings should be enabled by default (same as -w). # and like in most test frameworks, deprecation warnings should be enabled by default,
# so that deprecations are noticed before the breaking change.
# Disable experimental warnings, we want to test new experimental features in ruby/spec.
if Object.const_defined?(:Warning) and Warning.respond_to?(:[]=) if Object.const_defined?(:Warning) and Warning.respond_to?(:[]=)
Warning[:deprecated] = true Warning[:deprecated] = true
Warning[:experimental] = false
end end
if Object.const_defined?(:Warning) and Warning.respond_to?(:warn) if Object.const_defined?(:Warning) and Warning.respond_to?(:warn)
@ -39,15 +42,6 @@ if Object.const_defined?(:Warning) and Warning.respond_to?(:warn)
when /passing a block to String#(bytes|chars|codepoints|lines) is deprecated/ when /passing a block to String#(bytes|chars|codepoints|lines) is deprecated/
when /core\/string\/modulo_spec\.rb:\d+: warning: too many arguments for format string/ when /core\/string\/modulo_spec\.rb:\d+: warning: too many arguments for format string/
when /regexp\/shared\/new_ascii(_8bit)?\.rb:\d+: warning: Unknown escape .+ is ignored/ when /regexp\/shared\/new_ascii(_8bit)?\.rb:\d+: warning: Unknown escape .+ is ignored/
# $VERBOSE = false warnings
when /constant ::(Fixnum|Bignum) is deprecated/
when /\/(argf|io|stringio)\/.+(ARGF|IO)#(lines|chars|bytes|codepoints) is deprecated/
when /Thread\.exclusive is deprecated.+\n.+thread\/exclusive_spec\.rb/
when /hash\/shared\/index\.rb:\d+: warning: Hash#index is deprecated; use Hash#key/
when /exponent(_spec)?\.rb:\d+: warning: in a\*\*b, b may be too big/
when /enumerator\/(new_spec|initialize_spec)\.rb:\d+: warning: Enumerator\.new without a block is deprecated/
when /Pattern matching is experimental, and the behavior may change in future versions of Ruby!/
else else
$stderr.write message $stderr.write message
end end

View File

@ -1,3 +1,6 @@
# This script is based on commands from the wiki:
# https://github.com/ruby/spec/wiki/Merging-specs-from-JRuby-and-other-sources
IMPLS = { IMPLS = {
truffleruby: { truffleruby: {
git: "https://github.com/oracle/truffleruby.git", git: "https://github.com/oracle/truffleruby.git",
@ -173,7 +176,7 @@ def test_new_specs
versions = versions.grep(/^\d+\./) # Test on MRI versions = versions.grep(/^\d+\./) # Test on MRI
min_version, max_version = versions.minmax min_version, max_version = versions.minmax
test_command = MSPEC ? "bundle exec rspec" : "../mspec/bin/mspec -j" test_command = MSPEC ? "bundle install && bundle exec rspec" : "../mspec/bin/mspec -j"
run_test = -> version { run_test = -> version {
command = "chruby #{version} && #{test_command}" command = "chruby #{version} && #{test_command}"