diff options
-rw-r--r-- | spec/mspec/README.md | 2 | ||||
-rw-r--r-- | spec/mspec/lib/mspec/utils/script.rb | 10 | ||||
-rw-r--r-- | spec/mspec/lib/mspec/utils/warnings.rb | 14 | ||||
-rw-r--r-- | spec/mspec/tool/sync/sync-rubyspec.rb | 5 |
4 files changed, 16 insertions, 15 deletions
diff --git a/spec/mspec/README.md b/spec/mspec/README.md index d4054bcf0f..e334d56972 100644 --- a/spec/mspec/README.md +++ b/spec/mspec/README.md @@ -53,7 +53,7 @@ To install the gem dependencies with Bundler, run the following: ruby -S bundle install ``` -## Running Specs +## Development 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. diff --git a/spec/mspec/lib/mspec/utils/script.rb b/spec/mspec/lib/mspec/utils/script.rb index e3478ef7b0..5c6ae70e5d 100644 --- a/spec/mspec/lib/mspec/utils/script.rb +++ b/spec/mspec/lib/mspec/utils/script.rb @@ -38,9 +38,7 @@ class MSpecScript end def initialize - ruby_version_is ""..."2.5" do - abort "MSpec needs Ruby 2.5 or more recent" - end + check_version! config[:formatter] = nil config[:includes] = [] @@ -280,4 +278,10 @@ class MSpecScript require 'mspec' script.run 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 diff --git a/spec/mspec/lib/mspec/utils/warnings.rb b/spec/mspec/lib/mspec/utils/warnings.rb index 288dbe71aa..c770d609f3 100644 --- a/spec/mspec/lib/mspec/utils/warnings.rb +++ b/spec/mspec/lib/mspec/utils/warnings.rb @@ -1,9 +1,12 @@ require 'mspec/guards/version' # 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?(:[]=) Warning[:deprecated] = true + Warning[:experimental] = false end 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 /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/ - - # $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 $stderr.write message end diff --git a/spec/mspec/tool/sync/sync-rubyspec.rb b/spec/mspec/tool/sync/sync-rubyspec.rb index 93e0f538ba..7f3dc0e611 100644 --- a/spec/mspec/tool/sync/sync-rubyspec.rb +++ b/spec/mspec/tool/sync/sync-rubyspec.rb @@ -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 = { truffleruby: { git: "https://github.com/oracle/truffleruby.git", @@ -173,7 +176,7 @@ def test_new_specs versions = versions.grep(/^\d+\./) # Test on MRI 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 { command = "chruby #{version} && #{test_command}" |