Update specs / mspec

This commit is contained in:
Marc-Andre Lafortune 2020-12-16 17:43:31 -05:00 committed by Marc-André Lafortune
parent 4f24b9b6b6
commit 733eeb24df
9 changed files with 63 additions and 5 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "frozen_old_spec/rubyspec"]
path = frozen_old_spec/rubyspec
url = git://github.com/ruby/spec.git
[submodule "spec/mspec"]
path = spec/mspec
url = git://github.com/ruby/mspec.git

View File

@ -172,7 +172,28 @@ EXTRA_SPECS = {
'enumerable/chain' => %w[enumerator/chain/*]
}
# RUBYSPEC_COMMIT = {
# 2.0.0 => '245862558761d5abc676843ef74f86c9bcc8ea8d',
# 2.1.0 => 'f029e65241374386077ac500add557ae65069b55',
# 2.2.0 => 'cbaa0e412270c944df0c2532fc500c920dba0e92',
# 2.3.0 => 'dc733114d8ae66a3368ba3a98422c50147a76ba5',
# 2.4.0 => 'bce4f2b81d6c31db67cf4d023a0625ceadde59bd',
# }.freeze
MSPEC_COMMIT = {
2.0 => 'f90efa068791064f955de7a843e96e2d7d3041c2',
2.1 => '55568ea3918c6380e64db8c567d732fa5781efed',
2.2 => 'd84d7668449e96856c5f6bac8cb1526b6d357ce3',
2.3 => '4599bc195fb109f2a482a01c32a7d659518369ea',
2.4 => 'e7eb8aa4c26495b7b461e687d950b96eb08b3ff2',
}.freeze
USE_MSPEC_GEM = RUBY_VERSION < '2.1'
def mspec_cmds(pattern, spec_folder, action='ci')
# unless USE_MSPEC_GEM
# `cd spec/mspec && git reset --hard #{MSPEC_COMMIT.fetch(RUBY_VERSION[0..2].to_f, 'master')}`
# end
pattern = "lib/backports/*.*.*/#{pattern}.rb"
Dir.glob(pattern) do |lib_path|
_match, version, path = lib_path.match(/backports\/(\d\.\d\.\d)\/(.*)\.rb/).to_a
@ -188,13 +209,27 @@ def mspec_cmds(pattern, spec_folder, action='ci')
deps = [*DEPENDENCIES[version_path]].map{|p| "-r #{p}"}.join(' ')
klass, method = path.split('/')
path = [CLASS_MAP[klass], method].join('/')
spec_paths = [path, *EXTRA_SPECS[path]].map {|p| "#{spec_folder}/rubyspec/core/#{p}_spec.rb" }
yield %W[mspec #{action}
spec_paths = [path, *EXTRA_SPECS[path]].map do |p|
p.gsub! /fixnum|bignum/, 'integer'
"#{spec_folder}/rubyspec/core/#{p}_spec.rb"
end
if USE_MSPEC_GEM
cmd = "mspec #{action}"
else
cmd = 'ruby'
main = "spec/mspec/bin/mspec-#{action}"
end
yield %W[ #{cmd}
-I lib
-r ./set_version/#{version}
#{deps}
-r backports/#{version_path}
#{spec_paths.join(' ')}
#{main}
#{spec_paths.join(' ')}
].join(' '), path
end
# unless USE_MSPEC_GEM
# `cd spec/mspec && git reset --hard origin/master`
# end
end

View File

@ -1,4 +1,6 @@
if (Backports::TARGET_VERSION rescue false) # Conf loaded at different times, not sure why
FrozenError ||= RuntimeError
class MSpecScript
# The set of substitutions to transform a spec filename
# into a tag filename.
@ -10,5 +12,14 @@ if (Backports::TARGET_VERSION rescue false) # Conf loaded at different times, no
set :tags_patterns, [ [%r(rubyspec/), "tags/#{main_version}/"] ]
end
SpecGuard.ruby_version_override = Backports::TARGET_VERSION if Backports::TARGET_VERSION > RUBY_VERSION
if Backports::TARGET_VERSION > RUBY_VERSION
if SpecGuard.respond_to? :ruby_version_override=
SpecGuard.ruby_version_override = Backports::TARGET_VERSION
else
class VersionGuard
remove_const :FULL_RUBY_VERSION
FULL_RUBY_VERSION = SpecVersion.new Backports::TARGET_VERSION
end
end
end
end

1
spec/mspec Submodule

@ -0,0 +1 @@
Subproject commit 92c27b8aa6d2727ca0f630052a4f291587beaf33

@ -1 +1 @@
Subproject commit 500ea3b890238c6041b8662f000fa394905e9003
Subproject commit be97c4d8263abb7213f2d096e63c34422f877f4a

View File

@ -0,0 +1,2 @@
fails:Hash#fetch_values with unmatched keys sets the Hash as the receiver of KeyError
fails:Hash#fetch_values with unmatched keys sets the unmatched key as the key of KeyError

View File

@ -0,0 +1,2 @@
fails:String#-@ returns the same object for equal unfrozen strings
fails:String#-@ returns the same object when it's called on the same String literal

View File

@ -0,0 +1,2 @@
fails:Hash#fetch_values with unmatched keys sets the Hash as the receiver of KeyError
fails:Hash#fetch_values with unmatched keys sets the unmatched key as the key of KeyError

View File

@ -0,0 +1,2 @@
fails:String#-@ returns the same object for equal unfrozen strings
fails:String#-@ returns the same object when it's called on the same String literal