mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 06:44:10 +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")
|
ShowFile("src/Program.bf")
|
||||||
|
|
||||||
SetExpectError("Generic argument")
|
SetExpectError("Generic argument")
|
||||||
|
SetExpectError("Unable to implicitly cast")
|
||||||
Compile()
|
Compile()
|
||||||
ExpectError()
|
ExpectError()
|
||||||
|
|
||||||
|
|
|
@ -3244,7 +3244,6 @@ namespace IDE
|
||||||
{
|
{
|
||||||
if (mScriptManager.IsErrorExpected(text))
|
if (mScriptManager.IsErrorExpected(text))
|
||||||
{
|
{
|
||||||
DeleteAndNullify!(mScriptManager.mExpectingError);
|
|
||||||
OutputLine("Received expected error: {0}", text);
|
OutputLine("Received expected error: {0}", text);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace IDE
|
||||||
public QueuedCmd mCurCmd;
|
public QueuedCmd mCurCmd;
|
||||||
public Stopwatch mTimeoutStopwatch ~ delete _;
|
public Stopwatch mTimeoutStopwatch ~ delete _;
|
||||||
public int mTimeoutMS;
|
public int mTimeoutMS;
|
||||||
public String mExpectingError ~ delete _;
|
public List<String> mExpectingErrors ~ DeleteContainerAndItems!(_);
|
||||||
public bool mHadExpectingError;
|
public bool mHadExpectingError;
|
||||||
public int mDoneTicks;
|
public int mDoneTicks;
|
||||||
public bool mIsBuildScript;
|
public bool mIsBuildScript;
|
||||||
|
@ -192,9 +192,25 @@ namespace IDE
|
||||||
//gApp.mRunningTestScript = false;
|
//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)
|
public void Fail(StringView fmt, params Object[] args)
|
||||||
|
@ -2321,24 +2337,31 @@ namespace IDE
|
||||||
[IDECommand]
|
[IDECommand]
|
||||||
public void SetExpectError(String error)
|
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;
|
ScriptManager.sActiveManager.mHadExpectingError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[IDECommand]
|
[IDECommand]
|
||||||
public void ClearExpectError()
|
public void ClearExpectError()
|
||||||
{
|
{
|
||||||
DeleteAndNullify!(ScriptManager.sActiveManager.mExpectingError);
|
if (ScriptManager.sActiveManager.mExpectingErrors != null)
|
||||||
|
{
|
||||||
|
DeleteContainerAndItems!(ScriptManager.sActiveManager.mExpectingErrors);
|
||||||
|
ScriptManager.sActiveManager.mExpectingErrors = null;
|
||||||
|
}
|
||||||
ScriptManager.sActiveManager.mHadExpectingError = false;
|
ScriptManager.sActiveManager.mHadExpectingError = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[IDECommand]
|
[IDECommand]
|
||||||
public void ExpectError()
|
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");
|
mScriptManager.Fail("Expected error did not occur");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,9 @@ PUSHD %~dp0..\
|
||||||
@CALL :TEST
|
@CALL :TEST
|
||||||
@IF !ERRORLEVEL! NEQ 0 GOTO HADERROR
|
@IF !ERRORLEVEL! NEQ 0 GOTO HADERROR
|
||||||
|
|
||||||
@REM @SET TESTPATH=IDE\Tests\BugW004
|
@SET TESTPATH=IDE\Tests\BugW004
|
||||||
@REM @CALL :TEST
|
@CALL :TEST
|
||||||
@REM @IF !ERRORLEVEL! NEQ 0 GOTO HADERROR
|
@IF !ERRORLEVEL! NEQ 0 GOTO HADERROR
|
||||||
|
|
||||||
@SET TESTPATH=IDE\Tests\BugW005
|
@SET TESTPATH=IDE\Tests\BugW005
|
||||||
@CALL :TEST
|
@CALL :TEST
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue