With this test code:
# models/tester.rb
class Tester < ActiveRecord::Base
def test1
self.some_attr.nil?
end
def test2
some_attr.nil?
end
end
And this test:
# spec/models/tester_spec.rb
require File.dirname(__FILE__) + '/../spec_helper'
describe Tester, "a tester" do
it "should pass a test" do
end
end
I get the following output with Heckle:
Finished in 0.056968 seconds
1 example, 0 failures
**********************************************************************
*** Tester#test1 loaded with 2 possible mutations
**********************************************************************
2 mutations remaining...
1 mutations remaining...
The following mutations didn't cause test failures:
--- original
+++ mutation
def test1
- self.some_attr.nil?
+ nil.nil?
end
--- original
+++ mutation
def test1
- self.some_attr.nil?
+ # do nothing
end
Finished in 0.064995 seconds
1 example, 0 failures
**********************************************************************
*** Tester#test2 loaded with 1 possible mutations
**********************************************************************
1 mutations remaining...
/usr/local/lib/ruby/gems/1.8/gems/ruby2ruby-1.1.7/lib/ruby2ruby.rb:243:in `process_call': You have a nil object when
you didn't expect it! (NoMethodError)
You might have expected an instance of Array.
The error occurred while evaluating nil.first from
/usr/local/lib/ruby/gems/1.8/gems/ParseTree-2.0.1/lib/sexp_processor.rb:241:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/ParseTree-2.0.1/lib/sexp_processor.rb:241:in `process'
from /usr/local/lib/ruby/gems/1.8/gems/ParseTree-2.0.1/lib/sexp_processor.rb:299:in `error_handler'
from /usr/local/lib/ruby/gems/1.8/gems/ParseTree-2.0.1/lib/sexp_processor.rb:240:in `process'
from /usr/local/lib/ruby/gems/1.8/gems/ruby2ruby-1.1.7/lib/ruby2ruby.rb:52:in `process'
from /usr/local/lib/ruby/gems/1.8/gems/ruby2ruby-1.1.7/lib/ruby2ruby.rb:244:in `process_call'
from /usr/local/lib/ruby/gems/1.8/gems/ParseTree-2.0.1/lib/sexp_processor.rb:241:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/ParseTree-2.0.1/lib/sexp_processor.rb:241:in `process'
... 30 levels...
from /Users/curtis/work/test_project/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:114:in `heckle'
from /Users/curtis/work/test_project/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:31:in `run'
from /Users/curtis/work/test_project/vendor/plugins/rspec/lib/spec/runner/command_line.rb:17:in `run'
from /Users/curtis/work/test_project/vendor/plugins/rspec/bin/spec:3
I also tried it with standard Test::Unit test case and running heckle directly - same result. May be related to 13267? |