diff --git a/IDE/Tests/BugW004/scripts/Test.txt b/IDE/Tests/BugW004/scripts/Test.txt index de6e3331..89a22c5f 100644 --- a/IDE/Tests/BugW004/scripts/Test.txt +++ b/IDE/Tests/BugW004/scripts/Test.txt @@ -4,6 +4,7 @@ ShowFile("src/Program.bf") SetExpectError("Generic argument") +SetExpectError("Unable to implicitly cast") Compile() ExpectError() diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf index b459688c..be465fec 100644 --- a/IDE/src/IDEApp.bf +++ b/IDE/src/IDEApp.bf @@ -3244,7 +3244,6 @@ namespace IDE { if (mScriptManager.IsErrorExpected(text)) { - DeleteAndNullify!(mScriptManager.mExpectingError); OutputLine("Received expected error: {0}", text); return null; } diff --git a/IDE/src/ScriptManager.bf b/IDE/src/ScriptManager.bf index 29cdd0ad..5ad7ca16 100644 --- a/IDE/src/ScriptManager.bf +++ b/IDE/src/ScriptManager.bf @@ -76,7 +76,7 @@ namespace IDE public QueuedCmd mCurCmd; public Stopwatch mTimeoutStopwatch ~ delete _; public int mTimeoutMS; - public String mExpectingError ~ delete _; + public List 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"); } } diff --git a/bin/test_ide.bat b/bin/test_ide.bat index db0d65ee..8aa1c6cd 100644 --- a/bin/test_ide.bat +++ b/bin/test_ide.bat @@ -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