add system-out as optional assert input

master
Markus Bergholz 7 years ago
parent 04f5c762ee
commit c5d639919f
  1. 11
      mUnittest.m

@ -97,6 +97,9 @@ function ret = assert(cond, msg, errormsg, successmsg, varargin)
if nargin <= 2
errormsg = sprintf('Test %d failed', countTests);
end
if nargin <= 3
successmsg = [];
end
if cond
@ -110,6 +113,7 @@ function ret = assert(cond, msg, errormsg, successmsg, varargin)
% concatinate global string for xml output
% xml = [xml sprintf('\n\t<testcase classname="%s #%d " name="%s" time="%.2f" />', className(), protectCount() , msg, this_time)];
xml = [xml sprintf('\n\t<testcase classname="%s #%d " name="%s" time="%.2f">', className(), protectCount() , msg, this_time)];
else
%% FAILED
% increase number of failed tests
@ -121,10 +125,15 @@ function ret = assert(cond, msg, errormsg, successmsg, varargin)
% concatinate global string for xml output
% xml = [xml sprintf('\n\t<testcase classname="%s #%d " name="%s" time="%.2f" >\n\t\t<failure type="assert"> %s </failure>\n\t</testcase>', className(), protectCount(), msg, t, errormsg)];
xml = [xml sprintf('\n\t<testcase classname="%s #%d " name="%s" time="%.2f" >\n\t\t<failure type="assert"> %s </failure>', className(), protectCount(), msg, t, errormsg)];
end
% system out for additional informations
xml = [xml sprintf('\n\t\t<system-out> bla bla bla default output </system-out>\n\t</testcase>')];
if isempty(successmsg)
xml = [xml sprintf('\n\t</testcase>')];
else
xml = [xml sprintf('\n\t\t<system-out> %s </system-out>\n\t</testcase>', successmsg)];
end
t = toc;
end

Loading…
Cancel
Save