Skip to content

Commit

Permalink
Merge pull request #247 from eugeneia/equal_fix
Browse files Browse the repository at this point in the history
[core.app] Fix bug in equal.
  • Loading branch information
lukego committed Aug 29, 2014
2 parents 8c7416e + 95ec129 commit 3d94be5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/app.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ function equal (x, y)
for k, v in pairs(x) do
if not equal(v, y[k]) then return false end
end
for k, _ in pairs(x) do
if y[k] == nil then return false end
for k, _ in pairs(y) do
if x[k] == nil then return false end
end
return true
else
Expand Down Expand Up @@ -277,6 +277,10 @@ function selftest ()
configure(config.new())
assert(#app_array == 0)
assert(#link_array == 0)
print("Testing equal")
assert(true == equal({foo="bar"}, {foo="bar"}))
assert(false == equal({foo="bar"}, {foo="bar", baz="foo"}))
assert(false == equal({foo="bar", baz="foo"}, {foo="bar"}))
print("OK")
end

Expand Down

0 comments on commit 3d94be5

Please sign in to comment.