free_mutant/spec/unit/mutant/mutator/literal/hash_spec.rb
2012-08-01 14:58:24 +02:00

34 lines
1.1 KiB
Ruby

require 'spec_helper'
describe Mutant::Mutator::Literal, 'hash' do
let(:source) { '{true => true, false => false}' }
let(:mutations) do
mutations = []
# Literal replaced with nil
mutations << [:nil]
# Mutation of each key and value in hash
mutations << [:hash, [:false ], [:true ], [:false], [:false]]
mutations << [:hash, [:nil ], [:true ], [:false], [:false]]
mutations << [:hash, [:true ], [:false], [:false], [:false]]
mutations << [:hash, [:true ], [:nil ], [:false], [:false]]
mutations << [:hash, [:true ], [:true ], [:true ], [:false]]
mutations << [:hash, [:true ], [:true ], [:nil ], [:false]]
mutations << [:hash, [:true ], [:true ], [:false], [:true ]]
mutations << [:hash, [:true ], [:true ], [:false], [:nil ]]
# Remove each key once
mutations << [:hash, [:true ], [:true ]]
mutations << [:hash, [:false ], [:false ]]
# Empty hash
mutations << [:hash]
# Extra element
mutations << [:hash, [:true ], [:true ], [:false], [:false ], [:nil], [:nil] ]
end
it_should_behave_like 'a mutator'
end