Fix bug in new criteria matcher

This commit is contained in:
Jason Perkins 2012-10-23 18:15:07 -04:00
parent 09334b4b1c
commit 0e8915ec1d
2 changed files with 11 additions and 1 deletions

View File

@ -51,7 +51,7 @@
function criteria.matches(crit, context)
local checkterm = function(term)
for _, value in ipairs(context) do
if value:match(term) then
if value:match(term) == value then
return true
end
end

View File

@ -45,3 +45,13 @@
crit = criteria.new { "orange", "pear" }
test.isfalse(criteria.matches(crit, { "apple", "orange" }))
end
--
-- Context terms must match the entire criteria term.
--
function suite.fails_onIncompleteMatch()
crit = criteria.new { "ps3" }
test.isfalse(criteria.matches(crit, { "ps3 ppu sn" }))
end