From 743c90c24a981f64aa4eddd86aef01d8b343d614 Mon Sep 17 00:00:00 2001 From: dmiller Date: Wed, 19 Feb 2014 18:32:25 +0000 Subject: [PATCH] Use nsedebug.tostr in unittest to more clearly show how tests fail. --- nselib/unittest.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nselib/unittest.lua b/nselib/unittest.lua index 6763f15d8..77dd403d1 100644 --- a/nselib/unittest.lua +++ b/nselib/unittest.lua @@ -19,6 +19,8 @@ local stdnse = require "stdnse" local string = require "string" local table = require "table" local nmap = require "nmap" +local nsedebug = require "nsedebug" +local listop = require "listop" _ENV = stdnse.module("unittest", stdnse.seeall) local libs = { @@ -234,7 +236,7 @@ make_test = function(test, fmt) local nargs = select("#", ...) return function(suite) 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 return true end