User adamantium (former immutable)

This commit is contained in:
Markus Schirp 2012-10-15 14:36:15 +02:00
parent cd35a6dcc6
commit 7ecf828768
21 changed files with 32 additions and 22 deletions

1
.rspec
View file

@ -1,2 +1,3 @@
--color
#--fail-fast
--backtrace

View file

@ -2,10 +2,10 @@ source 'https://rubygems.org'
gemspec
gem 'immutable', :git => 'https://github.com/dkubb/immutable.git', :branch => :experimental
gem 'adamantium', :git => 'https://github.com/mbj/adamantium.git', :branch => :'no-deep-freeze-etc'
gem 'descendants_tracker', :git => 'https://github.com/dkubb/descendants_tracker.git'
gem 'abstract_class', :git => 'https://github.com/dkubb/abstract_class.git'
gem 'equalizer', :git => 'https://github.com/dkubb/equalizer.git'
gem 'equalizer', :git => 'https://github.com/mbj/equalizer.git', :branch => :'adamantium-no-deep-freeze'
gem 'anima', :git => 'https://github.com/mbj/anima.git'
gem 'to_source', :git => 'https://github.com/mbj/to_source.git'

View file

@ -1,4 +1,5 @@
require 'immutable'
require 'backports'
require 'adamantium'
require 'ice_nine'
require 'abstract_class'
require 'descendants_tracker'
@ -7,7 +8,6 @@ require 'equalizer'
require 'to_source'
require 'ice_nine'
require 'ice_nine/core_ext/object'
require 'backports'
require 'anima'
require 'diff/lcs'
require 'diff/lcs/hunk'

View file

@ -1,7 +1,7 @@
module Mutant
# Comandline parser
class CLI
include Immutable
include Adamantium
# Error raised when CLI argv is inalid
Error = Class.new(RuntimeError)

View file

@ -1,7 +1,7 @@
module Mutant
# Class to colorize strings
class Color
include Immutable
include Adamantium
# Initialize color object
#

View file

@ -1,7 +1,7 @@
module Mutant
# An abstract context where mutations can be appied to.
class Context
include Immutable, AbstractClass
include Adamantium, AbstractClass
# Return root ast node
#

View file

@ -2,7 +2,7 @@ module Mutant
class Context
# Scope context for mutation (Class or Module)
class Scope < self
include Immutable, AbstractClass
include Adamantium, AbstractClass
# Class context for mutation
class Class < self

View file

@ -1,7 +1,7 @@
module Mutant
# Class to create diffs from source code
class Differ
include Immutable
include Adamantium
# Return source diff
#

View file

@ -1,7 +1,7 @@
module Mutant
# Abstract runner for mutant killers
class Killer
include Immutable, AbstractClass
include Adamantium, AbstractClass
extend MethodObject
# Test for kill failure

View file

@ -1,7 +1,7 @@
module Mutant
# Abstract matcher to find ASTs to mutate
class Matcher
include Enumerable, AbstractClass, Immutable
include Enumerable, AbstractClass, Adamantium
extend DescendantsTracker
# Enumerate subjects

View file

@ -2,7 +2,7 @@ module Mutant
class Matcher
# Matcher to find AST for method
class Method < self
include Immutable, Equalizer.new(:identification)
include Adamantium, Equalizer.new(:identification)
# Parse a method string into filter
#

View file

@ -3,7 +3,7 @@ module Mutant
class Method < self
# A classifier for input strings
class Classifier
include Immutable
include Adamantium
TABLE = {
'.' => Matcher::Method::Singleton,

View file

@ -1,7 +1,7 @@
module Mutant
# Represent a mutated node with its subject
class Mutation
include Immutable, Equalizer.new(:sha1)
include Adamantium, Equalizer.new(:sha1)
# Return mutation subject
#

View file

@ -2,7 +2,7 @@ module Mutant
class Mutation
# Abstract filter for mutations
class Filter
include Immutable, AbstractClass
include Adamantium, AbstractClass
extend DescendantsTracker
# Check for match

View file

@ -2,7 +2,7 @@ module Mutant
class Mutation
class Filter
class Whitelist < self
include Immutable, Equalizer.new(:whitelist)
include Adamantium, Equalizer.new(:whitelist)
# Test for match
#

View file

@ -1,7 +1,7 @@
module Mutant
# Generator for mutations
class Mutator
include Immutable, AbstractClass
include Adamantium, AbstractClass
# Enumerate mutations on node
#

View file

@ -1,7 +1,7 @@
module Mutant
# Abstract reporter
class Reporter
include Immutable, AbstractClass
include Adamantium, AbstractClass
# Report subject
#

View file

@ -1,7 +1,7 @@
module Mutant
# Runner that allows to mutate an entire project
class Runner
include Immutable, Anima
include Adamantium, Anima
extend MethodObject
attribute :matcher

View file

@ -1,7 +1,7 @@
module Mutant
# Subject of mutation
class Subject
include Immutable, Enumerable
include Adamantium, Enumerable
# Return context
#

View file

@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency('ice_nine', '~> 0.4.0')
gem.add_runtime_dependency('descendants_tracker', '~> 0.0.1')
gem.add_runtime_dependency('backports', '~> 2.6')
gem.add_runtime_dependency('immutable', '~> 0.0.1')
gem.add_runtime_dependency('adamantium', '~> 0.0.1')
gem.add_runtime_dependency('equalizer', '~> 0.0.1')
gem.add_runtime_dependency('abstract_class', '~> 0.0.1')
gem.add_runtime_dependency('anima', '~> 0.0.1')

View file

@ -18,7 +18,16 @@ describe Mutant::Matcher::Chain, '#each' do
matcher_b.stub(:each).and_yield(subject_b).and_return(matcher_b)
end
it_should_behave_like 'an #each method'
# it_should_behave_like 'an #each method'
context 'with no block' do
subject { object.each }
it { should be_instance_of(to_enum.class) }
it 'yields the expected values' do
subject.to_a.should eql(object.to_a)
end
end
let(:yields) { [] }