Merge pull request #761 from mbj/fix/recursive-prefix-length
Fix prefix check for equivalent recursive namespaces
This commit is contained in:
commit
9e504b688e
2 changed files with 4 additions and 2 deletions
|
@ -44,7 +44,9 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @return [Integer]
|
# @return [Integer]
|
||||||
def match_length(expression)
|
def match_length(expression)
|
||||||
if @recursion_pattern.match?(expression.syntax)
|
if eql?(expression)
|
||||||
|
syntax.length
|
||||||
|
elsif @recursion_pattern.match?(expression.syntax)
|
||||||
scope_name.length
|
scope_name.length
|
||||||
else
|
else
|
||||||
0
|
0
|
||||||
|
|
|
@ -22,7 +22,7 @@ RSpec.describe Mutant::Expression::Namespace::Recursive do
|
||||||
context 'when other is an equivalent expression' do
|
context 'when other is an equivalent expression' do
|
||||||
let(:other) { parse_expression(object.syntax) }
|
let(:other) { parse_expression(object.syntax) }
|
||||||
|
|
||||||
it { should be(0) }
|
it { should be(object.syntax.length) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when other expression describes a shorter prefix' do
|
context 'when other expression describes a shorter prefix' do
|
||||||
|
|
Loading…
Add table
Reference in a new issue