Sha256: 15e5054d1259229be2714a738e7d14bb5a03771e0f1f318389826a7857d75b2c

Contents?: true

Size: 699 Bytes

Versions: 8

Compression:

Stored size: 699 Bytes

Contents

require 'spec_helper'

describe Mutant::Mutator, 'begin' do

  # This mutation and only this mutation can result in
  # and empty emit that is parsed into nil, unparser cannot
  # handle this so we guard this here!
  def generate(node)
    return '' if node.nil?
    super
  end

  let(:source) { "true\nfalse" }

  let(:mutations) do
    mutations = []

    # Mutation of each statement in block
    mutations << "true\ntrue"
    mutations << "false\nfalse"
    mutations << "nil\nfalse"
    mutations << "true\nnil"

    # Remove statement in block
    mutations << 'true'
    mutations << 'false'

    # Replace block with empty
    mutations << ''
  end

  it_should_behave_like 'a mutator'
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutant-0.3.0.beta9 spec/unit/mutant/mutator/node/begin/mutation_spec.rb
mutant-0.3.0.beta8 spec/unit/mutant/mutator/node/begin/mutation_spec.rb
mutant-0.3.0.beta7 spec/unit/mutant/mutator/node/begin/mutation_spec.rb
mutant-0.3.0.beta6 spec/unit/mutant/mutator/node/begin/mutation_spec.rb
mutant-0.3.0.beta5 spec/unit/mutant/mutator/node/begin/mutation_spec.rb
mutant-0.3.0.beta4 spec/unit/mutant/mutator/node/begin/mutation_spec.rb
mutant-0.3.0.beta3 spec/unit/mutant/mutator/node/begin/mutation_spec.rb
mutant-0.3.0.beta2 spec/unit/mutant/mutator/node/begin/mutation_spec.rb