Sha256: 7cc926e5a50afce7598f0f55a71272a186c6fae28a07a6d21f5a5f0a94edb341

Contents?: true

Size: 1.52 KB

Versions: 14

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe Mutant::Mutator, 'block' do
  context 'with block' do
    let(:source) { 'foo() { a; b }' }

    let(:mutations) do
      mutations = []
      mutations << 'foo { a }'
      mutations << 'foo { b }'
      mutations << 'foo {}'
      mutations << 'foo { raise }'
      mutations << 'foo'
    end

    it_should_behave_like 'a mutator'
  end

  context 'with block args' do

    let(:source) { 'foo { |a, b| }' }

    before do
      Mutant::Random.stub(:hex_string => :random)
    end

    let(:mutations) do
      mutations = []
      mutations << 'foo'
      mutations << 'foo { |a, b| raise }'
      mutations << 'foo { |a, srandom| }'
      mutations << 'foo { |srandom, b| }'
      mutations << 'foo { |a| }'
      mutations << 'foo { |b| }'
      mutations << 'foo { || }'
    end

    it_should_behave_like 'a mutator'
  end

  context 'with block pattern args' do

    before do
      Mutant::Random.stub(:hex_string => :random)
    end

    let(:source) { 'foo { |(a, b), c| }' }

    let(:mutations) do
      mutations = []
      mutations << 'foo { || }'
      mutations << 'foo { |a, b, c| }'
      mutations << 'foo { |(a, b), c| raise }'
      mutations << 'foo { |(a), c| }'
      mutations << 'foo { |(b), c| }'
      mutations << 'foo { |(a, b)| }'
      mutations << 'foo { |c| }'
      mutations << 'foo { |(srandom, b), c| }'
      mutations << 'foo { |(a, srandom), c| }'
      mutations << 'foo { |(a, b), srandom| }'
      mutations << 'foo'
    end

    it_should_behave_like 'a mutator'
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mutant-0.3.0.beta21 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta20 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta19 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta18 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta17 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta16 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta15 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta14 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta13 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta12 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta11 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta10 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta9 spec/unit/mutant/mutator/node/block/mutation_spec.rb
mutant-0.3.0.beta8 spec/unit/mutant/mutator/node/block/mutation_spec.rb