Skip to content

Commit

Permalink
display last error filename and line
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelson-numerical-software committed Jul 31, 2021
1 parent 2dd5b3c commit d47813f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions modules/tests_manager/functions/test_run.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,24 @@
end
end
%=============================================================================
function displayFilenameAndLine(msg)
pos = -1;
if (length(msg.stack) > 0)
pos = 1;
if (msg.stack(1).line == 0)
pos = -1;
elseif (length(msg.stack) > 2) && (msg.stack(2).line ~= 0)
pos = 2;
else
pos = -1;
end
end
if pos > 0
disp([' ', _('File:'), ' ', msg.stack(pos).file]);
disp([' ', _('Line:'), ' ', num2str(msg.stack(pos).line)]);
end
end
%=============================================================================
function displayTestCaseFail(test_case)
if strcmp(test_case.status, 'Fail') == true
disp([' run(''', test_case.filename, ''')']);
Expand All @@ -136,6 +154,7 @@ function displayTestCaseFail(test_case)
else
if strcmp(class(test_case.msg), 'struct') == true
disp([' ', test_case.msg.message]);
displayFilenameAndLine(test_case.msg);
else
disp([' ', test_case.msg]);
end
Expand Down

0 comments on commit d47813f

Please sign in to comment.