From d55b11ca3144905b637b373428ba024927956f26 Mon Sep 17 00:00:00 2001 From: dmiller Date: Sat, 1 Apr 2017 02:00:39 +0000 Subject: [PATCH] Localize unittest.identical helper function, avoiding crash and speeding it up --- nselib/unittest.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nselib/unittest.lua b/nselib/unittest.lua index 607869218..88f930cb5 100644 --- a/nselib/unittest.lua +++ b/nselib/unittest.lua @@ -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, "") + return _identical(a, b, "") end end