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
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 |
# File 'lib/heckle.rb', line 705 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
725 726 727 |
# File 'lib/heckle.rb', line 725 def failure(original, failure) self.diff original, failure end |
#info(message) ⇒ Object
692 693 694 695 696 697 |
# File 'lib/heckle.rb', line 692 def info() puts "*"*70 puts "*** #{}" puts "*"*70 puts end |
#method_loaded(klass_name, method_name, mutations_left) ⇒ Object
677 678 679 |
# File 'lib/heckle.rb', line 677 def method_loaded(klass_name, method_name, mutations_left) info "#{klass_name}\##{method_name} loaded with #{mutations_left} possible mutations" end |
#no_failures ⇒ Object
699 700 701 702 703 |
# File 'lib/heckle.rb', line 699 def no_failures puts puts "The following mutations didn't cause test failures:" puts end |
#no_mutations(method_name) ⇒ Object
673 674 675 |
# File 'lib/heckle.rb', line 673 def no_mutations(method_name) warning "#{method_name} has a thick skin. There's nothing to heckle." end |
#no_surviving_mutants ⇒ Object
729 730 731 |
# File 'lib/heckle.rb', line 729 def no_surviving_mutants puts "No mutants survived. Cool!\n\n" end |
#remaining_mutations(mutations_left) ⇒ Object
681 682 683 |
# File 'lib/heckle.rb', line 681 def remaining_mutations(mutations_left) puts "#{mutations_left} mutations remaining..." end |
#replacing(klass_name, method_name, original, src) ⇒ Object
733 734 735 736 |
# File 'lib/heckle.rb', line 733 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
738 739 740 |
# File 'lib/heckle.rb', line 738 def report_test_failures puts "Tests failed -- this is good" if Heckle.debug end |
#warning(message) ⇒ Object
685 686 687 688 689 690 |
# File 'lib/heckle.rb', line 685 def warning() puts "!" * 70 puts "!!! #{}" puts "!" * 70 puts end |