Make non mri specific specs pass under RBX

This commit is contained in:
Markus Schirp 2014-06-08 19:51:04 +00:00
parent e9c5a37ea9
commit 822ddd799f
7 changed files with 29 additions and 25 deletions

View file

@ -18,9 +18,16 @@ module Mutant
def self.call(&block)
reader, writer = IO.pipe.each(&:binmode)
pid = fork do
reader.close
writer.write(Marshal.dump(block.call))
pid = fork
if pid.nil?
begin
reader.close
writer.write(Marshal.dump(block.call))
Kernel.exit!(0)
ensure
Kernel.exit!(1)
end
end
writer.close
@ -40,7 +47,7 @@ module Mutant
def self.read_result(reader, pid)
begin
data = Marshal.load(reader.read)
rescue ArgumentError
rescue ArgumentError, TypeError
raise Error, 'Childprocess wrote un-unmarshallable data'
end

View file

@ -32,7 +32,7 @@ module Mutant
#
def prepare
expected_warnings =
if name.equal?(:initialize)
if RUBY_ENGINE.eql?('ruby') && name.equal?(:initialize)
["#{__FILE__}:#{__LINE__ + 5}: warning: undefining `initialize' may cause serious problems\n"]
else
[]

View file

@ -10,7 +10,7 @@ describe 'Mutant on ruby corpus' do
TMP = ROOT.join('tmp').freeze
before do
pending 'Corpus test is deactivated on 1.9.3' if RUBY_VERSION.eql?('1.9.3')
skip 'Corpus test is deactivated on 1.9.3' if RUBY_VERSION.eql?('1.9.3')
end
MUTEX = Mutex.new

View file

@ -28,7 +28,7 @@ describe Mutant::Isolation do
let(:block) do
lambda do
redirect_stderr
$stderr # not mashallable, nothing written to pipe and raised exceptions in child
$stderr # not mashallable, nothing written to pipe and raises exception in child
end
end
@ -37,14 +37,13 @@ describe Mutant::Isolation do
end
end
context 'when block does return marshallable data, but process exits with nonzero exitstatus' do
context 'when block causes the child to exit nonzero' do
let(:block) do
lambda do
redirect_stderr
at_exit do
raise
method = Kernel.method(:exit!)
Kernel.define_singleton_method(:exit!) do |_status|
method.call(1)
end
:foo
end
end

View file

@ -11,16 +11,12 @@ describe Mutant::Matcher::Chain do
let(:matchers) { [matcher_a, matcher_b] }
let(:matcher_a) { double('Matcher A') }
let(:matcher_b) { double('Matcher B') }
let(:matcher_a) { [subject_a] }
let(:matcher_b) { [subject_b] }
let(:subject_a) { double('Subject A') }
let(:subject_b) { double('Subject B') }
before do
matcher_a.stub(:each).and_yield(subject_a).and_return(matcher_a)
matcher_b.stub(:each).and_yield(subject_b).and_return(matcher_b)
end
# it_should_behave_like 'an #each method'
context 'with no block' do
@ -28,12 +24,8 @@ describe Mutant::Matcher::Chain do
it { should be_instance_of(to_enum.class) }
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
pending 'FIX RBX rspec? BUG HERE'
else
it 'yields the expected values' do
expect(subject.to_a).to eql(object.to_a)
end
it 'yields the expected values' do
expect(subject.to_a).to eql(object.to_a)
end
end

View file

@ -34,7 +34,7 @@ describe Mutant::Matcher::Namespace do
it { should be_instance_of(to_enum.class) }
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
pending 'FIX RBX rspec? BUG HERE'
skip 'FIX RBX rspec? BUG HERE'
else
it 'yields the expected values' do
expect(subject.to_a).to eql(object.to_a)

View file

@ -1,6 +1,12 @@
require 'spec_helper'
describe Mutant::WarningFilter do
before do
if RUBY_ENGINE.eql?('rbx')
skip 'Disabled because expected warnings are from MRI'
end
end
let(:object) { described_class.new(target) }
let(:target) do