Skip to content

Commit

Permalink
parsing replacements w.out lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
bver committed May 9, 2012
1 parent 48e397f commit 8fe1c15
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions lib/mutation_simplify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,21 @@ def parse_lambdas( texts, patterns, refs )
end

def parse_replacement( texts, refs, lambdas )
replacement = []

texts.each do |line|
idx = refs.index line.strip
if idx.nil?
symb,rule = line.split('=')
symb.strip!
# TODO: unknown replacement if rule.nil?
replacement << Expansion.new( symb, text2alt( symb, rule.strip ) )
else
replacement << idx
end
end

replacement
end

protected
Expand Down
4 changes: 3 additions & 1 deletion test/tc_mutation_simplify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,9 @@ def test_replace_replace
'expr.tree2'
]

replacement = parse_replacement( texts, refs, [] )
s = MutationSimplify.new @grammar

replacement = s.parse_replacement( texts, refs, [] )
assert_equal( @outcome4, replacement )

end
Expand Down

0 comments on commit 8fe1c15

Please sign in to comment.