@ -34,7 +34,7 @@ function mock.patch(...)
table.insert(patches, p)
end
dfhack.with_finalize(
return dfhack.with_finalize(
function()
for _, p in ipairs(patches) do
p.table[p.key] = p.old_value
@ -44,7 +44,7 @@ function mock.patch(...)
p.table[p.key] = p.new_value
callback()
return callback()
)
@ -90,3 +90,11 @@ function test.patch_complex_key()
end)
expect.eq(t[key], 'value')
function test.patch_callback_return_value()
local a, b = mock.patch({}, 'k', 'v', function()
return 3, 4
expect.eq(a, 3)
expect.eq(b, 4)