Run file unittests, do not try to read coverage file if program not compiled

This commit is contained in:
Basile Burg 2016-04-14 22:11:38 +02:00
parent 9f346bfa05
commit b375257dbd
1 changed files with 12 additions and 10 deletions

View File

@ -304,7 +304,7 @@ type
procedure asyncprocOutput(sender: TObject); procedure asyncprocOutput(sender: TObject);
procedure asyncprocTerminate(sender: TObject); procedure asyncprocTerminate(sender: TObject);
procedure unittestDone(Sender: TObject); procedure unittestDone(Sender: TObject);
procedure compileRunnable(unittest: boolean = false); function compileRunnable(unittest: boolean = false): boolean;
procedure executeRunnable(unittest: boolean = false; redirect: boolean = true; procedure executeRunnable(unittest: boolean = false; redirect: boolean = true;
const runArgs: string = ''); const runArgs: string = '');
@ -1993,7 +1993,7 @@ begin
form.Free; form.Free;
end; end;
procedure TCEMainForm.compileRunnable(unittest: boolean = false); function TCEMainForm.compileRunnable(unittest: boolean = false): boolean;
var var
i: integer; i: integer;
fname: string; fname: string;
@ -2002,6 +2002,7 @@ var
firstLineFlags: string = ''; firstLineFlags: string = '';
begin begin
result := false;
fMsgs.clearByData(fDoc); fMsgs.clearByData(fDoc);
FreeRunnableProc; FreeRunnableProc;
if fDoc.isNil then exit; if fDoc.isNil then exit;
@ -2060,6 +2061,7 @@ begin
sysutils.DeleteFile(fname + objExt); sysutils.DeleteFile(fname + objExt);
if (dmdProc.ExitStatus = 0) then if (dmdProc.ExitStatus = 0) then
begin begin
result := true;
fMsgs.message(shortenPath(fDoc.fileName, 25) + ' successfully compiled', fMsgs.message(shortenPath(fDoc.fileName, 25) + ' successfully compiled',
fDoc, amcEdit, amkInf); fDoc, amcEdit, amkInf);
end end
@ -2164,7 +2166,7 @@ procedure TCEMainForm.actFileUnittestExecute(Sender: TObject);
begin begin
if fDoc.isNil then if fDoc.isNil then
exit; exit;
compileRunnable(true); if compileRunnable(true) then
executeRunnable(true, true); executeRunnable(true, true);
end; end;
@ -2172,7 +2174,7 @@ procedure TCEMainForm.actFileCompAndRunExecute(Sender: TObject);
begin begin
if fDoc.isNil then if fDoc.isNil then
exit; exit;
compileRunnable(false); if compileRunnable(false) then
executeRunnable(false, true); executeRunnable(false, true);
end; end;
@ -2180,7 +2182,7 @@ procedure TCEMainForm.actFileCompileAndRunOutExecute(Sender: TObject);
begin begin
if fDoc.isNil then if fDoc.isNil then
exit; exit;
compileRunnable(false); if compileRunnable(false) then
executeRunnable(false, false); executeRunnable(false, false);
end; end;
@ -2192,7 +2194,7 @@ begin
exit; exit;
if not InputQuery('Execution arguments', '', runargs) then if not InputQuery('Execution arguments', '', runargs) then
exit; exit;
compileRunnable(false); if compileRunnable(false) then
executeRunnable(false, true, runargs); executeRunnable(false, true, runargs);
end; end;