Merge branch 'master' into flexible-rspec

Conflicts:
	lib/mutant/strategy/method_expansion.rb
	lib/mutant/strategy/rspec/dm2.rb
	lib/mutant/strategy/rspec/dm2/lookup.rb
	lib/mutant/strategy/rspec/dm2/lookup/method.rb
	spec/unit/mutant/strategy/method_expansion/class_methods/run_spec.rb
	spec/unit/mutant/strategy/rspec/dm2/lookup/method/instance/spec_files_spec.rb
	spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb
This commit is contained in:
Markus Schirp 2013-08-02 00:28:15 +02:00
commit 37f0ed29b7
204 changed files with 956 additions and 68 deletions

2
.rspec
View file

@ -1,3 +1,5 @@
--color
--format progress
--profile
--warnings
--order random

View file

@ -1,20 +1,25 @@
language: ruby
script: 'bundle exec rake ci'
rvm:
- 1.9.3
- 2.0.0
- ruby-head
- rbx-19mode
- ruby-head
- jruby-19mode
before_install: gem install bundler
bundler_args: --without yard guard benchmarks
script: "bundle exec rake ci"
matrix:
include:
- rvm: 1.9.3
- rvm: 2.0.0
- rvm: ruby-head
- rvm: rbx-19mode
- rvm: jruby-19mode
env: JRUBY_OPTS="$JRUBY_OPTS --debug"
- rvm: jruby-head
env: JRUBY_OPTS="$JRUBY_OPTS --debug"
allow_failures:
- rvm: jruby-19mode # No fork(2) support, workaround planned
- rvm: ruby-head # Broken at this time, bundler issue on travis
- rvm: rbx-19mode # Broken at this time, yard/yardstick issue
- rvm: ruby-head # Broken at this time, rvm issue on travis
- rvm: rbx-19mode # Broken at this time, yard/yardstick issue
- rvm: jruby-19mode # No fork(2) support, workaround planned
- rvm: jruby-head # No fork(2) support, workaround planned
notifications:
irc:
channels:
- irc.freenode.org#rom-rb
- irc.freenode.org#mutant
on_success: never
on_failure: change

View file

@ -153,7 +153,8 @@ Your options:
* GitHub Issues https://github.com/mbj/mutant/issues
* Ping me on https://twitter.com/_m_b_j_
* #rom-rb channel on freenode, I hang around on CET daytimes. (nick mbj)
* #mutant channel on freenode, I hang around on CET daytimes. (nick mbj)
You'll also find others [ROM](https://github.com/rom-rb) team members here that can answer questions.
Credits
-------

View file

@ -1,4 +1,7 @@
# encoding: utf-8
require 'devtools'
Devtools.init_rake_tasks
Rake.application.load_imports

View file

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# encoding: utf-8
trap('INT') do |status|
exit! 128 + status

View file

@ -1,2 +1,2 @@
---
unit_test_timeout: 1.0
unit_test_timeout: 5.0

View file

@ -1,3 +1,3 @@
---
threshold: 16
total_score: 773
total_score: 764

View file

@ -3,6 +3,7 @@ AllCops:
- '../**/*.rake'
- 'Gemfile'
- 'Gemfile.devtools'
- 'mutant.gemspec'
Excludes:
- '**/vendor/**'
- '**/benchmarks/**'

View file

@ -1,3 +1,5 @@
# encoding: utf-8
require 'benchmark'
require 'set'
require 'adamantium'

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# An AST cache
class Cache

View file

@ -1,3 +1,5 @@
# encoding: utf-8
require 'optparse'
module Mutant

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class CLI
# A classifier for input strings
@ -6,15 +8,19 @@ module Mutant
include Equalizer.new(:identifier)
SCOPE_NAME_PATTERN = /[A-Za-z][A-Za-z_0-9]*/.freeze
OPERATOR_PATTERN = Regexp.union(*OPERATOR_METHODS.map(&:to_s)).freeze
METHOD_NAME_PATTERN =
/([_A-Za-z][A-Za-z0-9_]*[!?=]?|#{OPERATOR_PATTERN})/.freeze
SCOPE_PATTERN =
/(?:::)?#{SCOPE_NAME_PATTERN}(?:::#{SCOPE_NAME_PATTERN})*/.freeze
CBASE_PATTERN = /\A::/.freeze
SCOPE_OPERATOR = '::'.freeze
SINGLETON_PATTERN = /\A(#{SCOPE_PATTERN})\z/.freeze
SCOPE_NAME_PATTERN = /[A-Za-z][A-Za-z\d_]*/.freeze
SCOPE_OPERATOR = '::'.freeze
CBASE_PATTERN = /\A#{SCOPE_OPERATOR}/.freeze
METHOD_NAME_PATTERN = Regexp.union(
/[A-Za-z_][A-Za-z\d_]*[!?=]?/,
*OPERATOR_METHODS.map(&:to_s)
).freeze
SCOPE_PATTERN = /
(?:#{SCOPE_OPERATOR})?#{SCOPE_NAME_PATTERN}
(?:#{SCOPE_OPERATOR}#{SCOPE_NAME_PATTERN})*
/x.freeze
REGISTRY = []
@ -39,10 +45,10 @@ module Mutant
#
def self.constant_lookup(location)
location
.gsub(CBASE_PATTERN, EMPTY_STRING)
.sub(CBASE_PATTERN, EMPTY_STRING)
.split(SCOPE_OPERATOR)
.reduce(Object) do |parent, name|
parent.const_get(name)
parent.const_get(name, nil)
end
end
@ -124,6 +130,7 @@ module Mutant
# @api private
#
abstract_method :matcher
private :matcher
end # Classifier
end # CLI

View file

@ -1,23 +1,33 @@
# encoding: utf-8
module Mutant
class CLI
class Classifier
# Explicit method classifier
class Method < self
register
TABLE = {
'.' => Matcher::Methods::Singleton,
'#' => Matcher::Methods::Instance
'#' => Matcher::Methods::Instance,
}.freeze
REGEXP =
%r(\A(#{SCOPE_PATTERN})([.#])(#{METHOD_NAME_PATTERN}\z)).freeze
REGEXP = /
\A
(#{SCOPE_PATTERN})
([.#])
(#{METHOD_NAME_PATTERN})
\z
/x.freeze
# Positions of captured regexp groups
SCOPE_NAME_POSITION = 1
SCOPE_SYMBOL_POSITION = 2
METHOD_NAME_POSITION = 3
private
# Return method matcher
#
# @return [Matcher::Method]
@ -29,18 +39,6 @@ module Mutant
end
memoize :matcher
# Return identification
#
# @return [String]
#
# @api private
#
def identification
match.to_s
end
private
# Return method
#
# @return [Method, UnboundMethod]
@ -50,7 +48,7 @@ module Mutant
def method
methods_matcher.methods.detect do |method|
method.name == method_name
end or raise("Cannot find method #{identification}")
end or raise NameError, "Cannot find method #{identifier}"
end
memoize :method, :freezer => :noop

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class CLI
class Classifier
@ -29,15 +31,17 @@ module Mutant
# Recursive namespace classifier
class Recursive < self
REGEXP = /\A(#{SCOPE_PATTERN})\*\z/.freeze
REGEXP = /\A(#{SCOPE_PATTERN})\*\z/.freeze
MATCHER = Matcher::Namespace
register
end # Recursive
# Recursive namespace classifier
class Flat < self
REGEXP = /\A(#{SCOPE_PATTERN})\z/.freeze
REGEXP = /\A(#{SCOPE_PATTERN})\z/.freeze
MATCHER = Matcher::Scope
register
end # Flat

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class CLI
class Classifier

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# Class to colorize strings
class Color

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# The configuration of a mutator run
class Config

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
METHOD_POSTFIX_EXPANSIONS = {

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# An abstract context where mutations can be appied to.
class Context

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Context
# Scope context for mutation (Class or Module)

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# Class to create diffs from source code
class Differ

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# Abstract base class for mutant killers
class Killer

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Killer

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Killer

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Killer
# Runner for rspec tests

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Killer
# Abstract base class for killer with static result

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# Base class for code loaders
class Loader

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# Abstract matcher to find subjects to mutate
class Matcher

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Matcher
# A chain of matchers

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Matcher
# Matcher for subjects that are a specific method
@ -52,16 +54,16 @@ module Mutant
#
def skip?
location = source_location
if location.nil? or BLACKLIST.match(location.first)
if location.nil? || BLACKLIST.match(location.first)
message = sprintf(
'%s does not have valid source location unable to emit matcher',
method.inspect
)
$stderr.puts(message)
return true
true
else
false
end
false
end
# Return method name

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Matcher
class Method

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Matcher
class Method

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Matcher
class Method

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Matcher
# Abstract base class for matcher that returns method subjects from scope

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Matcher

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Matcher
# Matcher for specific namespace

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# Represent a mutated node with its subject
class Mutation

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutation
# Evul mutation

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutation
# Abstract filter for mutations

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutation
class Filter

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutation
class Filter

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutation
class Filter

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutation
# Neutral mutation

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# Generator for mutations
class Mutator

View file

@ -1,6 +1,10 @@
# encoding: utf-8
module Mutant
# Generator for mutations
class Mutator
# Abstract base class for node mutators
class Node < self
include AbstractType, NodeHelpers, Unparser::Constants

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Node

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
# Registry for mutators

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
# Namespace for utility mutators

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Util

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Mutator
class Util

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# Mixin for node helpers
module NodeHelpers

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# Module for generating random values
module Random

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# Abstract base class for reporters
class Reporter

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Reporter
# Reporter that reports in human readable format

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Reporter
class CLI

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Reporter
class CLI

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Reporter
class CLI

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Reporter
class CLI

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Reporter
class CLI

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Reporter

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
# Runner baseclass
class Runner

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Runner
# Runner for object config

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Runner
# Mutation runner

View file

@ -1,3 +1,5 @@
# encoding: utf-8
module Mutant
class Runner
# Subject specific runner

View file

@ -1,3 +1,5 @@
# encoding: utf-8
# Singleton methods are defined here so zombie can pick them up
module Mutant

Some files were not shown because too many files have changed in this diff Show more