- fix an issue where [ThingyThatReturnsFalse and 'hi'] ['test'] would return nothing instead of just test.

This commit is contained in:
ckknight
2008-04-02 02:48:31 +00:00
parent 5aff03ddbd
commit a1da731e44
2 changed files with 18 additions and 3 deletions

View File

@ -1382,9 +1382,17 @@ local function compile(ast, nsList, t, cachedTags, events, functions, extraKwarg
t[#t+1] = "\n"
end
t[#t+1] = "end;\n"
for k in pairs(firstResults) do
if k ~= "nil" and k ~= "boolean" then
totalResults[k] = true
if astType == 'and' then
for k in pairs(firstResults) do
if k == "nil" or k == "boolean" then
totalResults[k] = true
end
end
else
for k in pairs(firstResults) do
if k ~= "nil" and k ~= "boolean" then
totalResults[k] = true
end
end
end
for k in pairs(secondResults) do

View File

@ -3156,6 +3156,13 @@ assert_equal(DogTag:Evaluate("[Two (One ? One)]", "Unit"), 21)
assert_equal(DogTag:Evaluate("[One:Color(\"95e495\")]"), "|cff95e4951|r")
assert_equal(DogTag:Evaluate("[One:Color(\"999999\")]"), "|cff9999991|r")
assert_equal(DogTag:Evaluate("[OtherRetSame('good') ? 'hi'] ['test']"), "hi test")
assert_equal(DogTag:Evaluate("[OtherRetSame(nil) ? 'hi'] ['test']"), "test")
assert_equal(DogTag:Evaluate("[OtherRetSame('good') or nil] ['test']"), "good test")
assert_equal(DogTag:Evaluate("[OtherRetSame(nil) or 'hi'] ['test']"), "hi test")
assert_equal(DogTag:Evaluate("[OtherRetSame('good') and 'hi'] ['test']"), "hi test")
assert_equal(DogTag:Evaluate("[OtherRetSame(nil) and 'hi'] ['test']"), "test")
assert_equal(parse("[Red][Name] [Realm]"), { "concat", { "tag", "Red" }, { "tag", "Name", }, " ", { "tag", "Realm" } })
assert_equal(DogTag:CleanCode("[Red][Name] [Realm]"), "[Red Name] [Realm]")