mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fixed Test4
This commit is contained in:
parent
230ff8270e
commit
1e446a655c
4 changed files with 35 additions and 12 deletions
|
@ -4,6 +4,7 @@
|
|||
ShowFile("src/Program.bf")
|
||||
|
||||
SetExpectError("Generic argument")
|
||||
SetExpectError("Unable to implicitly cast")
|
||||
Compile()
|
||||
ExpectError()
|
||||
|
||||
|
|
|
@ -3244,7 +3244,6 @@ namespace IDE
|
|||
{
|
||||
if (mScriptManager.IsErrorExpected(text))
|
||||
{
|
||||
DeleteAndNullify!(mScriptManager.mExpectingError);
|
||||
OutputLine("Received expected error: {0}", text);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace IDE
|
|||
public QueuedCmd mCurCmd;
|
||||
public Stopwatch mTimeoutStopwatch ~ delete _;
|
||||
public int mTimeoutMS;
|
||||
public String mExpectingError ~ delete _;
|
||||
public List<String> mExpectingErrors ~ DeleteContainerAndItems!(_);
|
||||
public bool mHadExpectingError;
|
||||
public int mDoneTicks;
|
||||
public bool mIsBuildScript;
|
||||
|
@ -192,9 +192,25 @@ namespace IDE
|
|||
//gApp.mRunningTestScript = false;
|
||||
}
|
||||
|
||||
public bool IsErrorExpected(StringView err)
|
||||
public bool IsErrorExpected(StringView err, bool remove = true)
|
||||
{
|
||||
return (mExpectingError != null) && (err.Contains(mExpectingError));
|
||||
if (mExpectingErrors == null)
|
||||
return false;
|
||||
for (let checkErr in mExpectingErrors)
|
||||
{
|
||||
if (err.Contains(checkErr))
|
||||
{
|
||||
if (remove)
|
||||
{
|
||||
delete checkErr;
|
||||
@checkErr.Remove();
|
||||
if (mExpectingErrors.IsEmpty)
|
||||
DeleteAndNullify!(mExpectingErrors);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Fail(StringView fmt, params Object[] args)
|
||||
|
@ -2321,24 +2337,31 @@ namespace IDE
|
|||
[IDECommand]
|
||||
public void SetExpectError(String error)
|
||||
{
|
||||
DeleteAndNullify!(ScriptManager.sActiveManager.mExpectingError);
|
||||
ScriptManager.sActiveManager.mExpectingError = new String(error);
|
||||
|
||||
if (ScriptManager.sActiveManager.mExpectingErrors == null)
|
||||
ScriptManager.sActiveManager.mExpectingErrors = new .();
|
||||
ScriptManager.sActiveManager.mExpectingErrors.Add(new String(error));
|
||||
ScriptManager.sActiveManager.mHadExpectingError = true;
|
||||
}
|
||||
|
||||
[IDECommand]
|
||||
public void ClearExpectError()
|
||||
{
|
||||
DeleteAndNullify!(ScriptManager.sActiveManager.mExpectingError);
|
||||
if (ScriptManager.sActiveManager.mExpectingErrors != null)
|
||||
{
|
||||
DeleteContainerAndItems!(ScriptManager.sActiveManager.mExpectingErrors);
|
||||
ScriptManager.sActiveManager.mExpectingErrors = null;
|
||||
}
|
||||
ScriptManager.sActiveManager.mHadExpectingError = false;
|
||||
}
|
||||
|
||||
[IDECommand]
|
||||
public void ExpectError()
|
||||
{
|
||||
if (ScriptManager.sActiveManager.mExpectingError != null)
|
||||
if (ScriptManager.sActiveManager.mExpectingErrors != null)
|
||||
{
|
||||
DeleteAndNullify!(ScriptManager.sActiveManager.mExpectingError);
|
||||
DeleteContainerAndItems!(ScriptManager.sActiveManager.mExpectingErrors);
|
||||
ScriptManager.sActiveManager.mExpectingErrors = null;
|
||||
mScriptManager.Fail("Expected error did not occur");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,9 +43,9 @@ PUSHD %~dp0..\
|
|||
@CALL :TEST
|
||||
@IF !ERRORLEVEL! NEQ 0 GOTO HADERROR
|
||||
|
||||
@REM @SET TESTPATH=IDE\Tests\BugW004
|
||||
@REM @CALL :TEST
|
||||
@REM @IF !ERRORLEVEL! NEQ 0 GOTO HADERROR
|
||||
@SET TESTPATH=IDE\Tests\BugW004
|
||||
@CALL :TEST
|
||||
@IF !ERRORLEVEL! NEQ 0 GOTO HADERROR
|
||||
|
||||
@SET TESTPATH=IDE\Tests\BugW005
|
||||
@CALL :TEST
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue