Sha256: a36c1fdcfb48c9f34e4eef5508a76fc5245ae9ac2e1e5df547d0e3a130823a67

Contents?: true

Size: 955 Bytes

Versions: 2

Compression:

Stored size: 955 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Mutant::Mutator::Node::Literal, 'array' do

  context 'on one item' do
    let(:source) { '[true]' }

    let(:mutations) do
      mutations = []
      mutations << 'nil'
      mutations << 'true'
      mutations << '[false]'
      mutations << '[nil]'
      mutations << '[]'
    end

    it_should_behave_like 'a mutator'
  end

  context 'on arrays with more than one item' do
    let(:source) { '[true, false]' }

    let(:mutations) do
      mutations = []

      # Literal replaced with nil
      mutations << 'nil'

      # Mutation of each element in array
      mutations << '[nil, false]'
      mutations << '[false, false]'
      mutations << '[true, nil]'
      mutations << '[true, true]'

      # Remove each element of array once
      mutations << '[true]'
      mutations << '[false]'

      # Empty array
      mutations << '[]'
    end

    it_should_behave_like 'a mutator'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutant-0.5.17 spec/unit/mutant/mutator/node/literal/array_spec.rb
mutant-0.5.16 spec/unit/mutant/mutator/node/literal/array_spec.rb