Class: Heckle::Reporter
- Inherits:
-
Object
- Object
- Heckle::Reporter
- Defined in:
- lib/heckle.rb
Instance Method Summary collapse
- #diff(original, mutation) ⇒ Object
- #failure(original, failure) ⇒ Object
- #info(message) ⇒ Object
- #method_loaded(klass_name, method_name, mutations_left) ⇒ Object
- #no_failures ⇒ Object
- #no_mutations(method_name) ⇒ Object
- #no_surviving_mutants ⇒ Object
- #remaining_mutations(mutations_left) ⇒ Object
- #replacing(klass_name, method_name, original, src) ⇒ Object
- #report_test_failures ⇒ Object
- #warning(message) ⇒ Object
Instance Method Details
#diff(original, mutation) ⇒ Object
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 |
# File 'lib/heckle.rb', line 631 def diff(original, mutation) length = [original.split(/\n/).size, mutation.split(/\n/).size].max Tempfile.open("orig") do |a| a.puts(original) a.flush Tempfile.open("fail") do |b| b.puts(mutation) b.flush diff_flags = " " output = `#{Heckle::DIFF} -U #{length} --label original #{a.path} --label mutation #{b.path}` puts output.sub(/^@@.*?\n/, '') puts end end end |
#failure(original, failure) ⇒ Object
651 652 653 |
# File 'lib/heckle.rb', line 651 def failure(original, failure) self.diff original, failure end |
#info(message) ⇒ Object
618 619 620 621 622 623 |
# File 'lib/heckle.rb', line 618 def info() puts "*"*70 puts "*** #{}" puts "*"*70 puts end |
#method_loaded(klass_name, method_name, mutations_left) ⇒ Object
603 604 605 |
# File 'lib/heckle.rb', line 603 def method_loaded(klass_name, method_name, mutations_left) info "#{klass_name}\##{method_name} loaded with #{mutations_left} possible mutations" end |
#no_failures ⇒ Object
625 626 627 628 629 |
# File 'lib/heckle.rb', line 625 def no_failures puts puts "The following mutations didn't cause test failures:" puts end |
#no_mutations(method_name) ⇒ Object
599 600 601 |
# File 'lib/heckle.rb', line 599 def no_mutations(method_name) warning "#{method_name} has a thick skin. There's nothing to heckle." end |
#no_surviving_mutants ⇒ Object
655 656 657 |
# File 'lib/heckle.rb', line 655 def no_surviving_mutants puts "No mutants survived. Cool!\n\n" end |
#remaining_mutations(mutations_left) ⇒ Object
607 608 609 |
# File 'lib/heckle.rb', line 607 def remaining_mutations(mutations_left) puts "#{mutations_left} mutations remaining..." end |
#replacing(klass_name, method_name, original, src) ⇒ Object
659 660 661 662 |
# File 'lib/heckle.rb', line 659 def replacing(klass_name, method_name, original, src) puts "Replacing #{klass_name}##{method_name} with:\n\n" diff(original, src) end |
#report_test_failures ⇒ Object
664 665 666 |
# File 'lib/heckle.rb', line 664 def report_test_failures puts "Tests failed -- this is good" end |
#warning(message) ⇒ Object
611 612 613 614 615 616 |
# File 'lib/heckle.rb', line 611 def warning() puts "!" * 70 puts "!!! #{}" puts "!" * 70 puts end |