aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lua/inspect.lua11
-rw-r--r--test/lua/verify_globals.lua9
2 files changed, 16 insertions, 4 deletions
diff --git a/test/lua/inspect.lua b/test/lua/inspect.lua
index 64b6b5bf5b..1a57ade8b6 100644
--- a/test/lua/inspect.lua
+++ b/test/lua/inspect.lua
@@ -648,10 +648,16 @@ end
function inspect.makeFilter(arrayTable)
local filter = {} -- our filter lookup tree (tables of tables)
local matchNode = {} -- a table instance we use as a key for nodes which match
+ local wildcard = {} -- a key table of wildcard match names
local function buildFilter(pathname)
local t = filter
local key
+ -- if the filtered name starts with a '.', it's a wildcard
+ if pathname:find("^%.") then
+ wildcard[pathname:sub(2)] = true
+ return
+ end
for sep, name in pathname:gmatch("([%.%[\"\']*)([^%.%[\"\'%]]+)[\"\'%]]?") do
if sep == '[' then
if name == 'true' then
@@ -689,8 +695,11 @@ function inspect.makeFilter(arrayTable)
buildFilter(pathname)
end
- return function(_,path)
+ return function(value,path)
local t = filter
+ if wildcard[ path[#path] ] then
+ return true
+ end
for _,v in ipairs(path) do
if not t[v] then
return false
diff --git a/test/lua/verify_globals.lua b/test/lua/verify_globals.lua
index 86d4a2a8b7..dbed8ceb91 100644
--- a/test/lua/verify_globals.lua
+++ b/test/lua/verify_globals.lua
@@ -19,7 +19,8 @@ local filter = {
-- differences caused by changes in wireshark 1.11
"NSTime",
"Proto",
- 'Listener["<metatable>"].__index'
+ 'Listener["<metatable>"].__index',
+ ".__index"
}
-- the following items don't have to exist
@@ -69,6 +70,8 @@ if #arg > 0 then
add_path = arg[1].."?.lua;"
end
+print("package.path = " .. package.path)
+
-- need the path to find inspect.lua
local old_path = package.path
package.path = add_path .. package.path
@@ -96,7 +99,7 @@ end
if #arg == 2 or arg[3] == "verify" then
print(string.rep("\n", 2))
- print("Verifying input file '"..arg[1].."' is contained within the global table")
+ print("Verifying input file '"..arg[2].."' is contained within the global table")
local ret, diff = inspect.compare(input, _G, {
['filter'] = inspect.makeFilter(filter),
['ignore'] = inspect.makeFilter(ignore),
@@ -114,7 +117,7 @@ if #arg == 2 or arg[3] == "verify" then
print("All tests passed!\n\n")
end
return
-elseif #arg > 1 and arg[2] == "new" then
+elseif #arg > 2 and arg[3] == "new" then
local ret, diff = inspect.compare(_G, input, {
['filter'] = inspect.makeFilter(filter),
['ignore'] = inspect.makeFilter(ignore),