mirror of
https://github.com/parnic/LibDogTag-3.0.git
synced 2025-06-17 04:21:53 -05:00
- fix an issue where [ThingyThatReturnsFalse and 'hi'] ['test'] would return nothing instead of just test.
This commit is contained in:
14
Compiler.lua
14
Compiler.lua
@ -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
|
||||
|
7
test.lua
7
test.lua
@ -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]")
|
||||
|
||||
|
Reference in New Issue
Block a user