Skip to content

Commit

Permalink
Merge branch 'master' into dumptypes
Browse files Browse the repository at this point in the history
  • Loading branch information
ike709 authored Jan 28, 2025
2 parents 84a8739 + d12f5ef commit 6fe2599
Show file tree
Hide file tree
Showing 230 changed files with 3,629 additions and 1,411 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.100
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
tar -czvf output_tools/OpenDreamServer_TOOLS_${{ matrix.os == 'windows-latest' && 'win-x64' || 'linux-x64' }}.tar.gz -C output_tools OpenDreamServer_${{ matrix.os == 'windows-latest' && 'win-x64' || 'linux-x64' }}
- name: Upload artifact
if: github.event_name == 'push'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}
path: |
Expand All @@ -73,7 +73,7 @@ jobs:
if: github.event_name == 'push'
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish latest release
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/compiler-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.100
- name: Install compiler dependencies
run: dotnet restore main/DMCompiler/DMCompiler.csproj
- name: Install disassembler dependencies
Expand All @@ -36,6 +36,10 @@ jobs:
run: dotnet build main/DMDisassembler/DMDisassembler.csproj --property WarningLevel=0 --configuration Release --no-restore /m
- name: Compile TestGame
run: main\bin\DMCompiler\DMCompiler.exe main\TestGame\environment.dme --suppress-unimplemented
- name: Compile TestGame in directory
run: |
cd main\TestGame\
..\bin\DMCompiler\DMCompiler.exe environment.dme --suppress-unimplemented
- name: Checkout /tg/station Master
uses: actions/checkout@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.100
- name: Setup Resharper
run: dotnet tool install -g JetBrains.ReSharper.GlobalTools
- name: Run Linter
Expand Down
10 changes: 10 additions & 0 deletions Content.IntegrationTests/DMProject/Tests/atom_appearance.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/obj/thingtocopy
name = "hello"
desc = "this is a thing"

/proc/test_appearance()
var/obj/thingtocopy/T = new()
var/obj/otherthing = new()
otherthing.appearance = T.appearance
ASSERT(otherthing.name == T.name)
ASSERT(otherthing.desc == T.desc)
Binary file added Content.IntegrationTests/DMProject/Tests/icons.dmi
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
plane = 123
icon_state = "subclass"

/proc/RunTest()
/proc/test_images()
ASSERT(image('icons.dmi', "mob") != null)

var/image/test = new /image/subclass
ASSERT(test.plane == 123)
ASSERT(test.icon_state == "subclass")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
out += dir
ASSERT(out == 14)

/proc/RunTest()
/proc/test_nonlocal_var()
var/mob/m = new
m.dodir()
13 changes: 13 additions & 0 deletions Content.IntegrationTests/DMProject/Tests/string_interpolation.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/obj/blombo
name = "Blombo"
gender = FEMALE

/obj/blorpo
name = "Blorpo"
gender = MALE

/proc/test_string_interpolation()
var/obj/blombo/b = new
var/obj/blorpo/b2 = new
var/result_text = "[b]? Nobody likes \him. \He is awful! Unlike [b2]. \He is pretty cool!"
ASSERT(result_text == "Blombo? Nobody likes her. She is awful! Unlike Blorpo. He is pretty cool!")
4 changes: 4 additions & 0 deletions Content.IntegrationTests/DMProject/code.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@
test_color_matrix()
test_range()
test_verb_duplicate()
test_appearance()
test_nonlocal_var()
test_images()
test_filter_init()
test_string_interpolation()
world.log << "IntegrationTests successful, /world/New() exiting..."
4 changes: 4 additions & 0 deletions Content.IntegrationTests/DMProject/environment.dme
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#include "code.dm"
#include "Tests/atom_appearance.dm"
#include "Tests/block.dm"
#include "Tests/color_matrix.dm"
#include "Tests/range.dm"
#include "Tests/verb_duplicate.dm"
#include "Tests/nonlocal_var.dm"
#include "Tests/image.dm"
#include "Tests/filter_initial.dm"
#include "Tests/string_interpolation.dm"
#include "map.dmm"
#include "interface.dmf"
1 change: 1 addition & 0 deletions Content.Tests/ContentUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Reflection;
using OpenDreamClient;
using OpenDreamRuntime;
using OpenDreamRuntime.Map;
using OpenDreamRuntime.Rendering;
using OpenDreamShared;
using OpenDreamShared.Rendering;
Expand Down
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
7 changes: 7 additions & 0 deletions Content.Tests/DMProject/Tests/Expression/String/raw2.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

//# issue 380

/proc/RunTest()
var/a = @(ZZZ)
asdfZZZ
ASSERT(a == "asdf")
7 changes: 7 additions & 0 deletions Content.Tests/DMProject/Tests/Expression/String/raw3.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

//# issue 380

/proc/RunTest()
var/a = @(ZZQ)
asdfZZQ
ASSERT(a == "asdf")
2 changes: 0 additions & 2 deletions Content.Tests/DMProject/Tests/Image/Image.dm

This file was deleted.

8 changes: 8 additions & 0 deletions Content.Tests/DMProject/Tests/List/ListAppendSelf.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/proc/RunTest()
var/L1 = list(1, 2)
L1 += L1
ASSERT(L1 ~= list(1, 2, 1, 2))

var/L2 = list(a=1, b=2)
L2 += L2
ASSERT(L2 ~= list(a=1, b=2, "a", "b"))
18 changes: 9 additions & 9 deletions Content.Tests/DMProject/Tests/Operators/Division.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,39 @@
var/list/expected = list(
1,
"Error",
10,
"Error",
"Error", // index 5
"Error",
"Error",
"Error",
"Error",
"Error", // index 10
"Error",
"Error",
"Error",
"Error",
"Error", // index 15
"Error",
"Error",
"Error",
"Error",
"Error", // index 20
"Error",
"Error",
"Error",
"Error",
"Error",
"Error",
"Error",
0,
0,
0,
0, // index 25
0,
0,
0,
0,
0, // index 30
0,
0,
0,
0,
"Error",
"Error",
"Error", // index 35
"Error",
"Error",
"Error",
Expand Down Expand Up @@ -128,4 +128,4 @@
"Error"
)

test_binary_operator(/proc/divide, expected)
test_binary_operator(/proc/divide, expected)
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var/list/operator_test_values = list(
result = "Error"

if (result ~! expected_result)
CRASH("Expected [json_encode(expected_result)] for [json_encode(a)], instead got [json_encode(result)]")
CRASH("Expected [json_encode(expected_result)] for [json_encode(a)], instead got [json_encode(result)] at index [i - 1]")

/proc/test_binary_operator(var/operator_proc, var/list/expected)
var/i = 1
Expand All @@ -48,4 +48,4 @@ var/list/operator_test_values = list(
result = "Error"

if (result ~! expected_result)
CRASH("Expected [json_encode(expected_result)] for [json_encode(a)] and [json_encode(b)], instead got [json_encode(result)]")
CRASH("Expected [json_encode(expected_result)] for [json_encode(a)] and [json_encode(b)], instead got [json_encode(result)] at index [i - 1]")
130 changes: 130 additions & 0 deletions Content.Tests/DMProject/Tests/Operators/valid_and_null.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
//simple test of all basic operators with valid and C(null) arguments
//We can't be having const folding in here
#define C(X) pick(X)
/proc/RunTest()
var/a = C(2)
ASSERT(!C(null) == C(1))
ASSERT(!!C(null) == C(0))

ASSERT(~C(1) == 16777214)
ASSERT(~C(0) == 16777215)
ASSERT(~C(null) == 16777215)

ASSERT(C(1) + C(1) == C(2))
ASSERT(C(null) + C(1) == C(1))
ASSERT(C(1) + C(null) == C(1))

ASSERT(C(1) - C(1) == C(0))
ASSERT(C(null) - C(1) == C(-1))
ASSERT(C(1) - C(null) == C(1))

a = C(2)
ASSERT(-a == C(-2))
a = C(null)
ASSERT(-a == C(0))

a = C(1)
ASSERT(a++ == C(1))
ASSERT(a == C(2))
ASSERT(++a == C(3))
ASSERT(a == C(3))

ASSERT(a-- == C(3))
ASSERT(a == C(2))
ASSERT(--a == C(1))
ASSERT(a == C(1))

a = C(null)
ASSERT(a-- == C(null))
ASSERT(a == C(-1))
a = C(null)
ASSERT(--a == C(-1))
ASSERT(a == C(-1))
a = C(null)
ASSERT(a++ == C(null))
ASSERT(a == C(1))
a = C(null)
ASSERT(++a == C(1))
ASSERT(a == C(1))

ASSERT(C(2) ** C(3) == 8)
ASSERT(C(2) ** C(null) == C(1))
ASSERT(C(null) ** C(2) == C(0))

ASSERT(C(2) * C(3) == 6)
ASSERT(C(2) * C(null) == C(0))
ASSERT(C(null) * C(2) == C(0))

ASSERT(C(4) / C(2) == C(2))
ASSERT(C(null) / C(2) == C(0))
ASSERT(C(2) / C(null) == C(2))
ASSERT(C(null) / C(null) == C(0))

ASSERT(C(4) % C(3) == C(1))
ASSERT(C(null) % C(3) == C(0))
//ASSERT(C(4) % C(null) == div by zero)

ASSERT(C(1) < C(1) == C(0))
ASSERT(C(null) < C(1) == C(1))
ASSERT(C(1) < C(null) == C(0))

ASSERT(C(1) <= C(1) == C(1))
ASSERT(C(null) <= C(1) == C(1))
ASSERT(C(1) <= C(null) == C(0))

ASSERT(C(1) > C(1) == C(0))
ASSERT(C(null) > C(1) == C(0))
ASSERT(C(1) > C(null) == C(1))

ASSERT(C(1) >= C(1) == C(1))
ASSERT(C(null) >= C(1) == C(0))
ASSERT(C(1) >= C(null) == C(1))

ASSERT(C(1) << C(1) == C(2))
ASSERT(C(null) << C(1) == C(0))
ASSERT(C(1) << C(null) == C(1))

ASSERT(C(1) >> C(1) == C(0))
ASSERT(C(null) >> C(1) == C(0))
ASSERT(C(1) >> C(null) == C(1))

ASSERT((C(1) == C(1)) == C(1))
ASSERT((C(null) == C(null)) == C(1))
ASSERT((C(null) == C(0)) == C(0))

ASSERT((C(1) != C(null)) == C(1))
ASSERT((C(null) != C(1)) == C(1))
ASSERT((C(null) != C(0)) == C(1))

ASSERT((C(1) <> C(null)) == C(1))
ASSERT((C(null) <> C(1)) == C(1))
ASSERT((C(null) <> C(0)) == C(1))

ASSERT((C(1) ~= C(1)) == C(1))
ASSERT((C(null) ~= C(null)) == C(1))
ASSERT((C(null) ~= C(0)) == C(0))

ASSERT((C(1) ~! C(1)) == C(0))
ASSERT((C(null) ~! C(null)) == C(0))
ASSERT((C(null) ~! C(0)) == C(1))

ASSERT((C(1) & C(1)) == C(1))
ASSERT((C(null) & C(1)) == C(0))
ASSERT((C(1) & C(null)) == C(0))

ASSERT((C(1) ^ C(1)) == C(0))
ASSERT((C(null) ^ C(5)) == C(5))
ASSERT((C(5) ^ C(null)) == C(5))

ASSERT((C(1) | C(1)) == C(1))
ASSERT((C(null) | C(1)) == C(1))
ASSERT((C(1) | C(null)) == C(1))

ASSERT((C(1) && C(1)) == C(1))
ASSERT((C(null) && C(1)) == C(null))
ASSERT((C(1) && C(null)) == C(null))

ASSERT((C(1) || C(1)) == C(1))
ASSERT((C(null) || C(1)) == C(1))
ASSERT((C(1) || C(null)) == C(1))

Loading

0 comments on commit 6fe2599

Please sign in to comment.