Use abstract support gem instead of homebrew
The support gem is better speced than the homebrew version ever was.
This commit is contained in:
parent
51e68800d4
commit
23a04009ce
11 changed files with 19 additions and 87 deletions
1
Gemfile
1
Gemfile
|
@ -3,6 +3,7 @@ source 'https://rubygems.org'
|
||||||
gemspec
|
gemspec
|
||||||
|
|
||||||
gem 'immutable', :git => 'https://github.com/mbj/immutable'
|
gem 'immutable', :git => 'https://github.com/mbj/immutable'
|
||||||
|
gem 'abstract', :git => 'https://github.com/mbj/abstract'
|
||||||
|
|
||||||
# Until there is a release with explicit sends to self fix
|
# Until there is a release with explicit sends to self fix
|
||||||
gem 'to_source', :git => 'https://github.com/mbj/to_source'
|
gem 'to_source', :git => 'https://github.com/mbj/to_source'
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
require 'immutable'
|
require 'immutable'
|
||||||
|
require 'abstract'
|
||||||
require 'securerandom'
|
require 'securerandom'
|
||||||
require 'to_source'
|
require 'to_source'
|
||||||
require 'ice_nine'
|
require 'ice_nine'
|
||||||
|
@ -33,7 +34,6 @@ module Mutant
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
require 'mutant/support/abstract'
|
|
||||||
require 'mutant/random'
|
require 'mutant/random'
|
||||||
require 'mutant/runner'
|
require 'mutant/runner'
|
||||||
#require 'mutant/runner/rspec'
|
#require 'mutant/runner/rspec'
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
module Mutant
|
module Mutant
|
||||||
# An abstract context where mutations can be appied to.
|
# An abstract context where mutations can be appied to.
|
||||||
class Context
|
class Context
|
||||||
include Immutable
|
include Immutable, Abstract
|
||||||
extend Abstract
|
|
||||||
|
|
||||||
# Return root ast for mutated node
|
# Return root ast for mutated node
|
||||||
#
|
#
|
||||||
|
@ -12,6 +11,6 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
abstract :root
|
abstract_method :root
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
module Mutant
|
module Mutant
|
||||||
# Abstract matcher to find ASTs to mutate
|
# Abstract matcher to find ASTs to mutate
|
||||||
class Matcher
|
class Matcher
|
||||||
include Enumerable
|
include Enumerable, Abstract
|
||||||
extend Abstract
|
|
||||||
|
|
||||||
# Enumerate subjects
|
# Enumerate subjects
|
||||||
#
|
#
|
||||||
|
@ -10,7 +9,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @return [undefined]
|
# @return [undefined]
|
||||||
#
|
#
|
||||||
abstract :each
|
abstract_method :each
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
abstract :method
|
abstract_method :method
|
||||||
|
|
||||||
# Return node classes this matcher matches
|
# Return node classes this matcher matches
|
||||||
#
|
#
|
||||||
|
@ -94,7 +94,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
abstract :node_class
|
abstract_method :node_class
|
||||||
|
|
||||||
# Check if node is matched
|
# Check if node is matched
|
||||||
#
|
#
|
||||||
|
@ -160,7 +160,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
abstract :matched_node
|
abstract_method :matched_node
|
||||||
|
|
||||||
# Return subject
|
# Return subject
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
module Mutant
|
module Mutant
|
||||||
# Generator for mutations
|
# Generator for mutations
|
||||||
class Mutator
|
class Mutator
|
||||||
include Immutable
|
include Immutable, Abstract
|
||||||
extend Abstract
|
|
||||||
|
|
||||||
# Enumerate mutations on node
|
# Enumerate mutations on node
|
||||||
#
|
#
|
||||||
|
@ -65,7 +64,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
abstract :dispatch
|
abstract_method :dispatch
|
||||||
|
|
||||||
# Append node to generated mutations if node does not equal orignal node
|
# Append node to generated mutations if node does not equal orignal node
|
||||||
#
|
#
|
||||||
|
|
|
@ -23,7 +23,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
abstract :inverse
|
abstract_method :inverse
|
||||||
|
|
||||||
# Represent mutations of true literal
|
# Represent mutations of true literal
|
||||||
class TrueLiteral < Boolean
|
class TrueLiteral < Boolean
|
||||||
|
|
|
@ -48,7 +48,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
abstract :inverse_class
|
abstract_method :inverse_class
|
||||||
|
|
||||||
# Mutator for range exclude literals
|
# Mutator for range exclude literals
|
||||||
class Exclude < Range
|
class Exclude < Range
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
module Mutant
|
module Mutant
|
||||||
# Abstract runner for tests
|
# Abstract runner for tests
|
||||||
class Runner
|
class Runner
|
||||||
include Immutable
|
include Immutable, Abstract
|
||||||
extend Abstract
|
|
||||||
|
|
||||||
# Run runner
|
# Run runner
|
||||||
#
|
#
|
||||||
|
@ -75,6 +74,6 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
abstract :run
|
abstract_method :run
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
module Mutant
|
|
||||||
# Module to declare abstract methods
|
|
||||||
module Abstract
|
|
||||||
|
|
||||||
# Declare abstract instance method
|
|
||||||
#
|
|
||||||
# @return [self]
|
|
||||||
#
|
|
||||||
# @api private
|
|
||||||
#
|
|
||||||
def abstract(*names)
|
|
||||||
names.each do |name|
|
|
||||||
define_instance_method(name)
|
|
||||||
end
|
|
||||||
|
|
||||||
self
|
|
||||||
end
|
|
||||||
|
|
||||||
# Declare abstract singleton method
|
|
||||||
#
|
|
||||||
# @return [self]
|
|
||||||
#
|
|
||||||
# @api private
|
|
||||||
#
|
|
||||||
def abstract_singleton(*names)
|
|
||||||
names.each do |name|
|
|
||||||
define_singleton_method(name)
|
|
||||||
end
|
|
||||||
|
|
||||||
self
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
# Define abstract method stub on singleton
|
|
||||||
#
|
|
||||||
# @param [String] name
|
|
||||||
#
|
|
||||||
# @return [undefined]
|
|
||||||
#
|
|
||||||
# @api private
|
|
||||||
#
|
|
||||||
def define_singleton_method(name)
|
|
||||||
class_eval(<<-RUBY, __FILE__, __LINE__+1)
|
|
||||||
def #{name}(*)
|
|
||||||
raise NotImplementedError, "\#{self.name}.\#{__method__} is not implemented"
|
|
||||||
end
|
|
||||||
RUBY
|
|
||||||
end
|
|
||||||
|
|
||||||
# Define abstract method stub on instances
|
|
||||||
#
|
|
||||||
# @param [String] name
|
|
||||||
#
|
|
||||||
# @return [undefined]
|
|
||||||
#
|
|
||||||
# @api private
|
|
||||||
#
|
|
||||||
def define_instance_method(name)
|
|
||||||
class_eval(<<-RUBY, __FILE__, __LINE__+1)
|
|
||||||
def #{name}(*)
|
|
||||||
raise NotImplementedError, "\#{self.class.name}#\#{__method__} is not implemented"
|
|
||||||
end
|
|
||||||
RUBY
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -16,7 +16,9 @@ Gem::Specification.new do |gem|
|
||||||
gem.test_files = `git ls-files -- spec`.split("\n")
|
gem.test_files = `git ls-files -- spec`.split("\n")
|
||||||
gem.extra_rdoc_files = %w[TODO]
|
gem.extra_rdoc_files = %w[TODO]
|
||||||
|
|
||||||
gem.add_dependency('to_source', '~> 0.1.3')
|
gem.add_runtime_dependency('to_source', '~> 0.1.3')
|
||||||
gem.add_dependency('ice_nine', '~> 0.4.0')
|
gem.add_runtime_dependency('ice_nine', '~> 0.4.0')
|
||||||
gem.add_runtime_dependency('backports', '~> 2.6')
|
gem.add_runtime_dependency('backports', '~> 2.6')
|
||||||
|
gem.add_runtime_dependency('immutable', '~> 0.0.1')
|
||||||
|
gem.add_runtime_dependency('abstract', '~> 0.0.1')
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue