1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-03 05:09:14 +00:00

Localize unittest.identical helper function, avoiding crash and speeding it up

This commit is contained in:
dmiller
2017-04-01 02:00:39 +00:00
parent 50bd248c2d
commit d55b11ca31

View File

@@ -348,7 +348,7 @@ end
-- distinguishability otherwise.
identical = function(a, b)
return function(suite)
function identical(val1, val2, path)
local function _identical(val1, val2, path)
local table_size = function(tbl)
local count = 0
for k in pairs(tbl) do
@@ -381,7 +381,7 @@ identical = function(a, b)
for k,v in pairs(val1) do
-- Check that the key's value is identical in both tables, passing
-- along the path of keys we have taken to get here.
local status, note = identical(val1[k], val2[k], string.format('%s["%s"]', path, k))
local status, note = _identical(val1[k], val2[k], string.format('%s["%s"]', path, k))
if not status then
return false, note
end
@@ -390,7 +390,7 @@ identical = function(a, b)
return true
end
return identical(a, b, "<top>")
return _identical(a, b, "<top>")
end
end