Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a3aae093a0d3
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dce612ecd028
Choose a head ref
  • 4 commits
  • 53 files changed
  • 1 contributor

Commits on Sep 14, 2017

  1. Squashed 'spec/mspec/' changes from 353605f..5bd9409

    5bd9409 Fix error message
    c0a8800 Simplify path to the mspec repo
    237978b sync: check if the last commit on a branch is too old and it should be deleted
    98c0ba4 Require yaml lazily in the MultiFormatter
    7b67e04 Cleanly check the minimal Ruby version
    c2028fc Add TruffleRuby in CI
    2461384 Fix total time substitution if a process takes more than 10 seconds
    436d0a3 Ensure the MSpec module is defined before including it
    de02c7f Remove gemspec
    41c7c4a Fix spec on rubies without Integer unification
    aaead3b script.rb: skip empty directories
    060f5db Ignore some warnings which are meaningless in ruby/spec
    9841726 Suppress warnings while defining mocks methods
    58cb854 Fix references to Fixnum
    ee4f8cc Rename
    9206b52 Always initialize @env on MSpec
    6164ce7 Use a simple Proc
    1ea0da6 Pass an explicit array to MSpecOption#parse
    d0bca39 Use a normal local variable to capture the exception in RaiseErrorMatcher
    b705672 Use stub_const
    e7fd07c Unshare HaveInstanceVariableMatcher specs
    2c83db4 Unshare HaveClassVariableMatcher specs
    f90714c Use stub_const to avoid warnings
    ed7ce4f Remove method before redefining it
    
    git-subtree-dir: spec/mspec
    git-subtree-split: 5bd940960da76cdb37e8b5c78388d4fada27c69a
    eregon committed Sep 14, 2017
    Copy the full SHA
    1f2d1f2 View commit details
  2. Copy the full SHA
    3c2023b View commit details
  3. Squashed 'spec/ruby/' changes from c3e6b90..a4bc1d8

    a4bc1d8 Remove trailing spaces
    9ba5ed7 Added rb_hash_fetch C-API.
    94126c4 Add Random::DEFAULT as an instance of Random (rubinius/rubinius#3752)
    ea724dd Add version guard and bug reference to track backports
    6d4b2d0 getoptlong.rb: multiline regexps
    5588c14 spec_helper.rb: pass jobserver fds
    c2fd40b fix type
    a18b1b4 Included module's prepend should not obscure reflection.
    892d3db Add test for a form of destructuring for syntax that was previously unspec'd.
    a6a1938 [spec] how to_r dispatch happens with BasicObject (in more detail)
    bc33d63 Use the fact that #exit accepts true/false
    df59fda Prefer *ruby_exe to *RUBY_EXE.split
    16554c9 Fix mixed declarations and code (C90)
    24437a1 Functions used by rb_define_method should return VALUE
    ffe0f10 Remove spec of non-existing method
    c8c728d Rewrite Kernel#exit! specs so they don't need #fork
    d7abf9c Add for Kernel#exit! in a Fiber
    61f1daf Add rb_proc_call and spec
    9e943fc Fix -v option behavior
    7825028 Add rb_range_beg_len
    8b7d7da Add st spec
    9124fdb Add spec for too big day-of-the-month with Time.new
    569572c Add spec for $0 in ruby -e 'p $0'
    3da482c Add rb_proc_arity
    fd3ad41 Add rb_gc and spec
    ad30489 Add rb_tainted_str_new2
    d83060e Add some basic specs for FIX2INT and FIX2UINT
    a4fa06d Improve spec of rb_fix2int/rb_fix2uint
    e32ec99 Add rb_tainted_str_new to C API
    7c96e35 Uncomment now working specs
    27ce415 Replace the referer header test value with a less confusing one
    dc164cb Remove no longer needed workaround
    fcdf8f8 Test status of externally killed threads
    c4dd322 Use commits which explicitly drop support for old versions
    3934d75 Specified versions for older specs
    c5529e1 Clarify which Ruby versions are supported
    dec709b Move spec out of quarantine
    e72db6c Remove Gemfile
    
    git-subtree-dir: spec/ruby
    git-subtree-split: a4bc1d8d46868e1a0389f0d40c37f0f556215b6e
    eregon committed Sep 14, 2017
    Copy the full SHA
    76e0c03 View commit details
  4. Copy the full SHA
    dce612e View commit details
Showing with 601 additions and 282 deletions.
  1. +11 −5 spec/mspec/.travis.yml
  2. +2 −2 spec/mspec/Gemfile
  3. +1 −7 spec/mspec/Gemfile.lock
  4. +3 −0 spec/mspec/README.md
  5. +6 −4 spec/mspec/lib/mspec/matchers/raise_error.rb
  6. +10 −5 spec/mspec/lib/mspec/mocks/mock.rb
  7. +2 −1 spec/mspec/lib/mspec/runner/formatters/multi.rb
  8. +6 −0 spec/mspec/lib/mspec/runner/mspec.rb
  9. +6 −1 spec/mspec/lib/mspec/utils/script.rb
  10. +19 −0 spec/mspec/lib/mspec/utils/warnings.rb
  11. +0 −40 spec/mspec/mspec.gemspec
  12. +4 −4 spec/mspec/spec/commands/mkspec_spec.rb
  13. +14 −14 spec/mspec/spec/commands/mspec_ci_spec.rb
  14. +1 −6 spec/mspec/spec/guards/guard_spec.rb
  15. +4 −19 spec/mspec/spec/guards/support_spec.rb
  16. +3 −3 spec/mspec/spec/helpers/io_spec.rb
  17. +2 −2 spec/mspec/spec/matchers/be_kind_of_spec.rb
  18. +5 −18 spec/mspec/spec/matchers/have_class_variable_spec.rb
  19. +6 −17 spec/mspec/spec/matchers/have_instance_variable_spec.rb
  20. +1 −1 spec/mspec/spec/runner/context_spec.rb
  21. +2 −2 spec/mspec/spec/runner/mspec_spec.rb
  22. +1 −1 spec/mspec/spec/spec_helper.rb
  23. +14 −7 spec/mspec/tool/sync/sync-rubyspec.rb
  24. +0 −3 spec/ruby/Gemfile
  25. +8 −0 spec/ruby/README.md
  26. +4 −2 spec/ruby/command_line/dash_e_spec.rb
  27. +7 −0 spec/ruby/command_line/dash_v_spec.rb
  28. +1 −1 spec/ruby/core/kernel/exit_spec.rb
  29. +7 −0 spec/ruby/core/random/default_spec.rb
  30. +3 −6 spec/ruby/core/struct/inspect_spec.rb
  31. +16 −0 spec/ruby/core/thread/status_spec.rb
  32. +0 −4 spec/ruby/core/thread/terminate_spec.rb
  33. +5 −0 spec/ruby/core/time/shared/time_params.rb
  34. +9 −0 spec/ruby/library/getoptlong/shared/get.rb
  35. +26 −83 spec/ruby/library/net/http/http/send_request_spec.rb
  36. +17 −3 spec/ruby/optional/capi/ext/fixnum_spec.c
  37. +11 −0 spec/ruby/optional/capi/ext/gc_spec.c
  38. +10 −0 spec/ruby/optional/capi/ext/hash_spec.c
  39. +3 −3 spec/ruby/optional/capi/ext/io_spec.c
  40. +20 −0 spec/ruby/optional/capi/ext/proc_spec.c
  41. +19 −0 spec/ruby/optional/capi/ext/range_spec.c
  42. +10 −0 spec/ruby/optional/capi/ext/rubyspec.h
  43. +82 −0 spec/ruby/optional/capi/ext/st_spec.c
  44. +20 −0 spec/ruby/optional/capi/ext/string_spec.c
  45. +51 −1 spec/ruby/optional/capi/fixnum_spec.rb
  46. +10 −0 spec/ruby/optional/capi/gc_spec.rb
  47. +19 −0 spec/ruby/optional/capi/hash_spec.rb
  48. +14 −0 spec/ruby/optional/capi/proc_spec.rb
  49. +27 −0 spec/ruby/optional/capi/range_spec.rb
  50. +8 −1 spec/ruby/optional/capi/spec_helper.rb
  51. +41 −0 spec/ruby/optional/capi/st_spec.rb
  52. +16 −0 spec/ruby/optional/capi/string_spec.rb
  53. +14 −16 spec/ruby/shared/process/exit.rb
16 changes: 11 additions & 5 deletions spec/mspec/.travis.yml
Original file line number Diff line number Diff line change
@@ -2,8 +2,14 @@ sudo: false
language: ruby
script:
- bundle exec rspec
rvm:
- 2.2.7
- 2.3.4
- 2.4.1
- ruby-head
matrix:
include:
- rvm: 2.2.7
- rvm: 2.3.4
- rvm: 2.4.1
- rvm: ruby-head
- jdk: oraclejdk8
install:
- curl -L https://github.com/graalvm/truffleruby/releases/download/vm-enterprise-0.27/truffleruby-testing-0.27.tar.gz | tar xz
- source truffleruby/setup_env
- bundle install
4 changes: 2 additions & 2 deletions spec/mspec/Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in mspec.gemspec
gemspec
gem "rake", "~> 10.0"
gem "rspec", "~> 2.14.1"
8 changes: 1 addition & 7 deletions spec/mspec/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
PATH
remote: .
specs:
mspec (1.8.0)

GEM
remote: https://rubygems.org/
specs:
@@ -22,9 +17,8 @@ PLATFORMS
ruby

DEPENDENCIES
mspec!
rake (~> 10.0)
rspec (~> 2.14.1)

BUNDLED WITH
1.10.2
1.14.5
3 changes: 3 additions & 0 deletions spec/mspec/README.md
Original file line number Diff line number Diff line change
@@ -33,6 +33,9 @@ specs in a manner compatible with multiple Ruby implementations.
configuration facility with a default project file and user-specific
overrides.

## Requirements

MSpec requires Ruby 2.2 or more recent.

## Bundler

10 changes: 6 additions & 4 deletions spec/mspec/lib/mspec/matchers/raise_error.rb
Original file line number Diff line number Diff line change
@@ -5,16 +5,18 @@ def initialize(exception, message, &block)
@exception = exception
@message = message
@block = block
@actual = nil
end

def matches?(proc)
@result = proc.call
return false
rescue Exception => @actual
if matching_exception?(@actual)
rescue Exception => actual
@actual = actual
if matching_exception?(actual)
return true
else
raise @actual
raise actual
end
end

@@ -54,7 +56,7 @@ def format_exception(exception)
def failure_message
message = ["Expected #{format_expected_exception}"]

if @actual then
if @actual
message << "but got #{format_exception(@actual)}"
else
message << "but no exception was raised (#{@result.pretty_inspect.chomp} was returned)"
15 changes: 10 additions & 5 deletions spec/mspec/lib/mspec/mocks/mock.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'mspec/expectations/expectations'
require 'mspec/helpers/warning'

module Mock
def self.reset
@@ -57,10 +58,12 @@ def self.install_method(obj, sym, type=nil)
meta.__send__ :alias_method, key.first, sym
end

meta.class_eval {
define_method(sym) do |*args, &block|
Mock.verify_call self, sym, *args, &block
end
suppress_warning {
meta.class_eval {
define_method(sym) do |*args, &block|
Mock.verify_call self, sym, *args, &block
end
}
}

proxy = MockProxy.new type
@@ -179,7 +182,9 @@ def self.cleanup
meta = obj.singleton_class

if mock_respond_to? obj, replaced, true
meta.__send__ :alias_method, sym, replaced
suppress_warning do
meta.__send__ :alias_method, sym, replaced
end
meta.__send__ :remove_method, replaced
else
meta.__send__ :remove_method, sym
3 changes: 2 additions & 1 deletion spec/mspec/lib/mspec/runner/formatters/multi.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'mspec/runner/formatters/spinner'
require 'yaml'

class MultiFormatter < SpinnerFormatter
def initialize(out=nil)
@@ -10,6 +9,8 @@ def initialize(out=nil)
end

def aggregate_results(files)
require 'yaml'

@timer.finish
@exceptions = []

6 changes: 6 additions & 0 deletions spec/mspec/lib/mspec/runner/mspec.rb
Original file line number Diff line number Diff line change
@@ -2,6 +2,9 @@
require 'mspec/runner/exception'
require 'mspec/runner/tag'

module MSpec
end

class MSpecEnv
include MSpec
end
@@ -399,4 +402,7 @@ def self.delete_tags
file = tags_file
File.delete file if File.exist? file
end

# Initialize @env
setup_env
end
7 changes: 6 additions & 1 deletion spec/mspec/lib/mspec/utils/script.rb
Original file line number Diff line number Diff line change
@@ -38,6 +38,10 @@ def self.get(key)
end

def initialize
if RUBY_VERSION < '2.2'
abort "MSpec needs Ruby 2.2 or more recent"
end

config[:formatter] = nil
config[:includes] = []
config[:excludes] = []
@@ -188,7 +192,8 @@ def entries(partial)
if File.file?(expanded) && expanded.end_with?('.rb')
return [expanded]
elsif File.directory?(expanded)
return Dir["#{expanded}/**/*_spec.rb"].sort
specs = Dir["#{expanded}/**/*_spec.rb"].sort
return specs unless specs.empty?
end
end

19 changes: 19 additions & 0 deletions spec/mspec/lib/mspec/utils/warnings.rb
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
ruby_version_is "2.4"..."2.5" do
# Kernel#warn does not delegate to Warning.warn in 2.4
module Kernel
remove_method :warn
def warn(*messages)
return if $VERBOSE == nil or messages.empty?
msg = messages.join("\n")
@@ -16,6 +17,24 @@ def warn(*messages)

def Warning.warn(message)
case message
# $VERBOSE = true warnings
when /possibly useless use of (<|<=|==|>=|>|\+|-) in void context/
when /assigned but unused variable/
when /method redefined/
when /previous definition of/
when /instance variable @.+ not initialized/
when /statement not reached/
when /shadowing outer local variable/
when /setting Encoding.default_(in|ex)ternal/
when /unknown (un)?pack directive/
when /(un)?trust(ed\?)? is deprecated/
when /\.exists\? is a deprecated name/
when /Float .+ out of range/
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/
40 changes: 0 additions & 40 deletions spec/mspec/mspec.gemspec

This file was deleted.

8 changes: 4 additions & 4 deletions spec/mspec/spec/commands/mkspec_spec.rb
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@
@options.stub(:on)
@options.should_receive(:on).with("-b", "--base", "DIR",
an_instance_of(String))
@script.options
@script.options []
end

it "sets the base directory relative to which the spec directories are created" do
@@ -62,7 +62,7 @@
@options.stub(:on)
@options.should_receive(:on).with("-r", "--require", "LIBRARY",
an_instance_of(String))
@script.options
@script.options []
end

it "adds CONSTANT to the list of constants" do
@@ -86,7 +86,7 @@
@options.stub(:on)
@options.should_receive(:on).with("-V", "--version-guard", "VERSION",
an_instance_of(String))
@script.options
@script.options []
end

it "sets the version for the ruby_version_is guards to VERSION" do
@@ -119,7 +119,7 @@
@options.should_receive(:raise).with(MSpecOptions::ParseError, an_instance_of(String))
@options.stub(:puts)
@options.stub(:exit)
@script.options "--iunknown"
@script.options ["--iunknown"]
end
end

28 changes: 14 additions & 14 deletions spec/mspec/spec/commands/mspec_ci_spec.rb
Original file line number Diff line number Diff line change
@@ -15,17 +15,17 @@

it "enables the chdir option" do
@options.should_receive(:chdir)
@script.options
@script.options []
end

it "enables the prefix option" do
@options.should_receive(:prefix)
@script.options
@script.options []
end

it "enables the config option" do
@options.should_receive(:configure)
@script.options
@script.options []
end

it "provides a custom action (block) to the config option" do
@@ -35,52 +35,52 @@

it "enables the dry run option" do
@options.should_receive(:pretend)
@script.options
@script.options []
end

it "enables the unguarded option" do
@options.should_receive(:unguarded)
@script.options
@script.options []
end

it "enables the interrupt single specs option" do
@options.should_receive(:interrupt)
@script.options
@script.options []
end

it "enables the formatter options" do
@options.should_receive(:formatters)
@script.options
@script.options []
end

it "enables the verbose option" do
@options.should_receive(:verbose)
@script.options
@script.options []
end

it "enables the action options" do
@options.should_receive(:actions)
@script.options
@script.options []
end

it "enables the action filter options" do
@options.should_receive(:action_filters)
@script.options
@script.options []
end

it "enables the version option" do
@options.should_receive(:version)
@script.options
@script.options []
end

it "enables the help option" do
@options.should_receive(:help)
@script.options
@script.options []
end

it "calls #custom_options" do
@script.should_receive(:custom_options).with(@options)
@script.options
@script.options []
end
end

@@ -99,7 +99,7 @@
@script.stub(:exit)
@script.stub(:config).and_return(@config)
@script.stub(:files).and_return(["one", "two"])
@script.options
@script.options []
end

it "registers the tags patterns" do
7 changes: 1 addition & 6 deletions spec/mspec/spec/guards/guard_spec.rb
Original file line number Diff line number Diff line change
@@ -4,12 +4,7 @@

describe SpecGuard, ".ruby_version" do
before :each do
@ruby_version = Object.const_get :RUBY_VERSION
Object.const_set :RUBY_VERSION, "8.2.3"
end

after :each do
Object.const_set :RUBY_VERSION, @ruby_version
stub_const "RUBY_VERSION", "8.2.3"
end

it "returns the full version for :full" do
Loading