Skip to content

Commit

Permalink
Division unit test fixes (#2150)
Browse files Browse the repository at this point in the history
Co-authored-by: ike709 <[email protected]>
  • Loading branch information
ike709 and ike709 authored Dec 30, 2024
1 parent f7b6d43 commit aab2f49
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// COMPILE ERROR
// COMPILE ERROR OD0011

var/a = 1 / 0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// COMPILE ERROR
// COMPILE ERROR OD0011

var/static/a = 1 / 0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// COMPILE ERROR
// COMPILE ERROR OD0011

/proc/one()
return 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// COMPILE ERROR
// COMPILE ERROR OD0011

var/const/a = 0
var/b = 1 / a
Expand Down
5 changes: 2 additions & 3 deletions Content.Tests/DMTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public void TestFiles(string sourceFile, DMTestFlags testFlags, int errorCode) {

Assert.That(compiledFile is not null && File.Exists(compiledFile), "Failed to compile DM source file");
Assert.That(_dreamMan.LoadJson(compiledFile), $"Failed to load {compiledFile}");
_dreamMan.LastDMException = null; // Nuke any exception from a prior test
_dreamMan.StartWorld();

(bool successfulRun, DreamValue? returned, Exception? exception) = RunTest();
Expand Down Expand Up @@ -114,8 +115,6 @@ public void TestFiles(string sourceFile, DMTestFlags testFlags, int errorCode) {
}

private (bool Success, DreamValue? Returned, Exception? except) RunTest() {
var prev = _dreamMan.LastDMException;

DreamValue? retValue = null;
Task<DreamValue> callTask = null!;

Expand Down Expand Up @@ -143,7 +142,7 @@ public void TestFiles(string sourceFile, DMTestFlags testFlags, int errorCode) {
}
}

bool retSuccess = _dreamMan.LastDMException == prev; // Works because "null == null" is true in this language.
bool retSuccess = _dreamMan.LastDMException == null; // Works because "null == null" is true in this language.
return (retSuccess, retValue, _dreamMan.LastDMException);
}

Expand Down

0 comments on commit aab2f49

Please sign in to comment.