Sha256: 35f4b0fc24960b1b3bf792271f13cf9c3672700a0a908869848338a398d840f6

Contents?: true

Size: 1.1 KB

Versions: 13

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

aggregate = Hash.new { |hash, key| hash[key] = [] }

Mutant::Meta::Example::ALL
  .each_with_object(aggregate) do |example, agg|
    example.types.each do |type|
      agg[Mutant::Mutator::REGISTRY.lookup(type)] << example
    end
  end

aggregate.each do |mutator, examples|
  RSpec.describe mutator do
    it 'generates expected mutations' do
      examples.each do |example|
        verification = example.verification
        fail verification.error_report unless verification.success?
      end
    end
  end
end

RSpec.describe Mutant::Mutator::Node do
  describe 'internal DSL' do
    let(:klass) do
      Class.new(described_class) do
        children(:left, :right)

        def dispatch
          left
          emit_left(s(:nil))
          emit_right_mutations do |node|
            node.eql?(s(:nil))
          end
        end
      end
    end

    def apply
      klass.call(s(:and, s(:true), s(:true)))
    end

    specify do
      expect(apply).to eql(
        [
          s(:and, s(:nil), s(:true)),
          s(:and, s(:true), s(:nil))
        ].to_set
      )
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mutant-0.9.8 spec/unit/mutant/mutator/node_spec.rb
mutant-0.9.7 spec/unit/mutant/mutator/node_spec.rb
mutant-0.9.6 spec/unit/mutant/mutator/node_spec.rb
mutant-0.9.5 spec/unit/mutant/mutator/node_spec.rb
mutant-0.9.4 spec/unit/mutant/mutator/node_spec.rb
mutant-0.9.3 spec/unit/mutant/mutator/node_spec.rb
mutant-0.9.2 spec/unit/mutant/mutator/node_spec.rb
mutant-0.9.1 spec/unit/mutant/mutator/node_spec.rb
mutant-0.9.0 spec/unit/mutant/mutator/node_spec.rb
mutant-0.8.24 spec/unit/mutant/mutator/node_spec.rb
mutant-0.8.23 spec/unit/mutant/mutator/node_spec.rb
mutant-0.8.22 spec/unit/mutant/mutator/node_spec.rb
mutant-0.8.21 spec/unit/mutant/mutator/node_spec.rb