mirror of
https://github.com/nmap/nmap.git
synced 2025-12-17 21:19:01 +00:00
Use nsedebug.tostr in unittest to more clearly show how tests fail.
This commit is contained in:
@@ -19,6 +19,8 @@ local stdnse = require "stdnse"
|
|||||||
local string = require "string"
|
local string = require "string"
|
||||||
local table = require "table"
|
local table = require "table"
|
||||||
local nmap = require "nmap"
|
local nmap = require "nmap"
|
||||||
|
local nsedebug = require "nsedebug"
|
||||||
|
local listop = require "listop"
|
||||||
_ENV = stdnse.module("unittest", stdnse.seeall)
|
_ENV = stdnse.module("unittest", stdnse.seeall)
|
||||||
|
|
||||||
local libs = {
|
local libs = {
|
||||||
@@ -234,7 +236,7 @@ make_test = function(test, fmt)
|
|||||||
local nargs = select("#", ...)
|
local nargs = select("#", ...)
|
||||||
return function(suite)
|
return function(suite)
|
||||||
if not test(table.unpack(args,1,nargs)) then
|
if not test(table.unpack(args,1,nargs)) then
|
||||||
return false, string.format(fmt, table.unpack(args,1,nargs))
|
return false, string.format(fmt, table.unpack(listop.map(nsedebug.tostr, args),1,nargs))
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user