diff --git a/lib/mutant/ast.rb b/lib/mutant/ast.rb index 5936dec5..7dfd78fe 100644 --- a/lib/mutant/ast.rb +++ b/lib/mutant/ast.rb @@ -44,7 +44,7 @@ module Mutant # @api private # def self.find_last_path(node, &predicate) - raise ArgumentError, 'block expected' unless block_given? + fail ArgumentError, 'block expected' unless block_given? path = [] walk(node, [node]) do |candidate, stack| if predicate.call(candidate, &predicate) diff --git a/lib/mutant/context/scope.rb b/lib/mutant/context/scope.rb index 22d23e5f..46e65e23 100644 --- a/lib/mutant/context/scope.rb +++ b/lib/mutant/context/scope.rb @@ -50,7 +50,7 @@ module Mutant when ::Module s(:module, name, node) else - raise "Cannot wrap scope: #{scope.inspect}" + fail "Cannot wrap scope: #{scope.inspect}" end end diff --git a/lib/mutant/expression/method.rb b/lib/mutant/expression/method.rb index 3d92bc2d..9e6ae908 100644 --- a/lib/mutant/expression/method.rb +++ b/lib/mutant/expression/method.rb @@ -25,7 +25,7 @@ module Mutant methods_matcher = MATCHERS.fetch(scope_symbol).new(env, scope) method = methods_matcher.methods.detect do |meth| meth.name.equal?(method_name) - end or raise NameError, "Cannot find method #{method_name}" + end or fail NameError, "Cannot find method #{method_name}" methods_matcher.matcher.build(env, scope, method) end diff --git a/lib/mutant/meta/example/dsl.rb b/lib/mutant/meta/example/dsl.rb index 63935e17..ca8cc339 100644 --- a/lib/mutant/meta/example/dsl.rb +++ b/lib/mutant/meta/example/dsl.rb @@ -40,7 +40,7 @@ module Mutant # @api private # def example - raise 'source not defined' unless @source + fail 'source not defined' unless @source Example.new(@file, @source, @expected) end @@ -55,7 +55,7 @@ module Mutant # @api private # def source(input) - raise 'source already defined' if @source + fail 'source already defined' if @source @source = node(input) self @@ -72,7 +72,7 @@ module Mutant def mutation(input) node = node(input) if @expected.include?(node) - raise "Node for input: #{input.inspect} is already expected" + fail "Node for input: #{input.inspect} is already expected" end @expected << node @@ -108,7 +108,7 @@ module Mutant when Parser::AST::Node input else - raise "Cannot coerce to node: #{source.inspect}" + fail "Cannot coerce to node: #{source.inspect}" end end diff --git a/lib/mutant/mutator/registry.rb b/lib/mutant/mutator/registry.rb index 35cfb3f1..dfe96664 100644 --- a/lib/mutant/mutator/registry.rb +++ b/lib/mutant/mutator/registry.rb @@ -39,7 +39,7 @@ module Mutant def self.lookup(node) type = node.type registry.fetch(type) do - raise ArgumentError, "No mutator to handle: #{type.inspect}" + fail ArgumentError, "No mutator to handle: #{type.inspect}" end end @@ -67,7 +67,7 @@ module Mutant # def self.assert_valid_type(type) unless AST::Types::ALL.include?(type) || type.is_a?(Class) - raise InvalidTypeError, "invalid type registration: #{type}" + fail InvalidTypeError, "invalid type registration: #{type}" end end private_class_method :assert_valid_type @@ -83,7 +83,7 @@ module Mutant # def self.assert_unique_type(type) if registry.key?(type) - raise DuplicateTypeError, "duplicate type registration: #{type}" + fail DuplicateTypeError, "duplicate type registration: #{type}" end end private_class_method :assert_unique_type