-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
247 changed files
with
8,023 additions
and
6,657 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/DMProject/Tests/Procs/verb_duplicate.dm → ...onTests/DMProject/Tests/verb_duplicate.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,51 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using OpenDreamClient; | ||
using OpenDreamRuntime; | ||
using OpenDreamRuntime.Rendering; | ||
using OpenDreamShared; | ||
using OpenDreamShared.Rendering; | ||
using Robust.Shared.Analyzers; | ||
using Robust.Shared.IoC; | ||
using Robust.UnitTesting; | ||
using EntryPoint = OpenDreamRuntime.EntryPoint; | ||
|
||
namespace Content.Tests | ||
{ | ||
[Virtual] | ||
public class ContentUnitTest : RobustUnitTest | ||
{ | ||
protected override void OverrideIoC() | ||
{ | ||
base.OverrideIoC(); | ||
|
||
SharedOpenDreamIoC.Register(); | ||
|
||
if (Project == UnitTestProject.Server) | ||
{ | ||
ServerContentIoC.Register(unitTests: true); | ||
IoCManager.Register<IDreamMapManager, DummyDreamMapManager>(); | ||
} | ||
else if (Project == UnitTestProject.Client) | ||
{ | ||
ClientContentIoC.Register(); | ||
} | ||
namespace Content.Tests; | ||
|
||
[Virtual] | ||
public class ContentUnitTest : RobustUnitTest { | ||
protected override Type[] ExtraComponents { get; } = { | ||
typeof(DMISpriteComponent), | ||
typeof(DreamMobSightComponent) | ||
}; | ||
|
||
protected override void OverrideIoC() { | ||
base.OverrideIoC(); | ||
|
||
SharedOpenDreamIoC.Register(); | ||
|
||
if (Project == UnitTestProject.Server) { | ||
ServerContentIoC.Register(unitTests: true); | ||
IoCManager.Register<IDreamMapManager, DummyDreamMapManager>(); | ||
} else if (Project == UnitTestProject.Client) { | ||
ClientContentIoC.Register(); | ||
} | ||
} | ||
|
||
protected override Assembly[] GetContentAssemblies() | ||
{ | ||
var l = new List<Assembly> | ||
{ | ||
typeof(OpenDreamShared.EntryPoint).Assembly | ||
}; | ||
|
||
if (Project == UnitTestProject.Server) | ||
{ | ||
l.Add(typeof(EntryPoint).Assembly); | ||
} | ||
else if (Project == UnitTestProject.Client) | ||
{ | ||
l.Add(typeof(OpenDreamClient.EntryPoint).Assembly); | ||
} | ||
|
||
l.Add(typeof(ContentUnitTest).Assembly); | ||
|
||
return l.ToArray(); | ||
protected override Assembly[] GetContentAssemblies() { | ||
var l = new List<Assembly> { | ||
typeof(OpenDreamShared.EntryPoint).Assembly | ||
}; | ||
|
||
if (Project == UnitTestProject.Server) { | ||
l.Add(typeof(EntryPoint).Assembly); | ||
} else if (Project == UnitTestProject.Client) { | ||
l.Add(typeof(OpenDreamClient.EntryPoint).Assembly); | ||
} | ||
|
||
l.Add(typeof(ContentUnitTest).Assembly); | ||
|
||
return l.ToArray(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/proc/RunTest() | ||
ASSERT(isnull(null)) | ||
var/obj/O = new() | ||
ASSERT(!isnull(O)) | ||
del(O) | ||
ASSERT(isnull(O)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
Content.Tests/DMProject/Tests/Statements/Switch/weird_when_clause.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
//Issue OD#996, kinda: https://github.com/OpenDreamProject/OpenDream/issues/996 | ||
|
||
/proc/RunTest() | ||
var/x = 5 | ||
switch(x) | ||
if(1) | ||
CRASH("Strange branch chosen in switch statement") | ||
if(4) | ||
CRASH("Strange branch chosen in switch statement") | ||
else if(x == 3) | ||
CRASH("Parser failed to understand 'else if' in switch block") | ||
else | ||
return | ||
CRASH("Parser failed to understand 'else if' in switch block") |
16 changes: 16 additions & 0 deletions
16
Content.Tests/DMProject/Tests/Statements/Switch/weird_when_clause_pragma.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//COMPILE ERROR | ||
//test to make sure SuspiciousSwitchCase is working | ||
|
||
#pragma SuspiciousSwitchCase error | ||
|
||
/proc/RunTest() | ||
var/x = 5 | ||
switch(x) | ||
if(1) | ||
return | ||
if(4) | ||
return | ||
else if(x == 3) | ||
return | ||
else | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/proc/RunTest() | ||
ASSERT({"A | ||
B | ||
C"} == "A\nB\nC") | ||
|
||
ASSERT({" " "} == " \" ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Issue #700 | ||
|
||
/proc/RunTest() | ||
ASSERT("[ "\[" ]" == @"[") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/proc/RunTest() | ||
var/test_text = "The average of 1, 2, 3, 4, 5 is: 3" | ||
var/list/test1 = splittext(test_text, " ") | ||
var/list/test1_expected = list("The","average","of","1,","2,","3,","4,","5","is:","3") | ||
ASSERT(test1 ~= test1_expected) | ||
|
||
var/list/test2 = splittext(test_text, " ", 5) | ||
var/test2_expected = list("average","of","1,","2,","3,","4,","5","is:","3") | ||
ASSERT(test2 ~= test2_expected) | ||
|
||
var/list/test3 = splittext(test_text, " ", 5, 10) | ||
var/test3_expected = list("avera") | ||
ASSERT(test3 ~= test3_expected) | ||
|
||
var/list/test4 = splittext(test_text, " ", 10, 20) | ||
var/test4_expected = list("ge","of","1,","2") | ||
ASSERT(test4 ~= test4_expected) | ||
|
||
var/list/test5 = splittext(test_text, " ", 10, 20, 1) | ||
var/test5_expected = list("ge"," ","of"," ","1,"," ","2") | ||
ASSERT(test5 ~= test5_expected) | ||
|
||
//it's regex time | ||
var/test6 = splittext(test_text, regex(@"\d")) | ||
var/test6_expected = list("The average of ",", ",", ",", ",", "," is: ","") | ||
ASSERT(test6 ~= test6_expected) | ||
|
||
var/test7 = splittext(test_text, regex(@"\d"), 5, 30) | ||
var/test7_expected = list("average of ",", ",", ",", ",", "," ") | ||
ASSERT(test7 ~= test7_expected) | ||
|
||
var/test8 = splittext(test_text, regex(@"\d"), 5, 30, 1) | ||
var/test8_expected = list("average of ","1",", ","2",", ","3",", ","4",", ","5"," ") | ||
ASSERT(test8 ~= test8_expected) |
Oops, something went wrong.