diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 054f820..d5c5549 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -1,9 +1,5 @@
name: '๐ฆ Release'
on:
- # Make a release whenever we push a version tag.
- push:
- tags:
- - 'v*'
# Make a release whenever the developer wants.
workflow_dispatch:
inputs:
@@ -72,15 +68,15 @@ jobs:
find: "0.0.0-devbuild"
replace: ${{ steps.next-version.outputs.version }}
regex: false
- include: Chickensoft.GoDotCollections/Chickensoft.GoDotCollections.csproj
+ include: Chickensoft.Collections/Chickensoft.Collections.csproj
- name: ๐ฆ Build
- run: dotnet build Chickensoft.GoDotCollections/Chickensoft.GoDotCollections.csproj -c Release
+ run: dotnet build Chickensoft.Collections/Chickensoft.Collections.csproj -c Release
- name: ๐ Get Package Path
id: package-path
run: |
- package=$(find ./Chickensoft.GoDotCollections/nupkg -name "*.nupkg")
+ package=$(find ./Chickensoft.Collections/nupkg -name "*.nupkg")
echo "package=$package" >> "$GITHUB_OUTPUT"
echo "๐ฆ Found package: $package"
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index c1b66fa..3070a98 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -31,23 +31,8 @@ jobs:
- name: ๐ฆ Restore Dependencies
run: dotnet restore
- - name: ๐ค Setup Godot
- uses: chickensoft-games/setup-godot@v2
- with:
- version: global.json
-
- - name: ๐ฌ Verify Setup
- run: |
- dotnet --version
- godot --version
-
- - name: ๐งโ๐ฌ Generate .NET Bindings
- working-directory: Chickensoft.GoDotCollections.Tests
- run: godot --headless --build-solutions --quit || exit 0
-
- name: ๐ฆบ Build Projects
run: dotnet build # --configuration Release
- name: ๐งช Run Tests
- working-directory: Chickensoft.GoDotCollections.Tests
- run: godot --headless --run-tests --quit-on-finish
+ run: dotnet test
diff --git a/.gitignore b/.gitignore
index 60591dc..3a2d1fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,7 @@
-Chickensoft.GoDotCollections/nupkg/
+Chickensoft.Collections/nupkg/
-Chickensoft.GoDotCollections.Tests/coverage/*
-!Chickensoft.GoDotCollections.Tests/coverage/.gdignore
+Chickensoft.Collections.Tests/coverage/*
-.godot/
bin/
obj/
.generated/
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index aeb1bcb..0000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,39 +0,0 @@
-{
- "version": "0.2.0",
- "configurations": [
- // For these launch configurations to work, you need to setup a GODOT
- // environment variable. On mac or linux, this can be done by adding
- // the following to your .zshrc, .bashrc, or .bash_profile file:
- // export GODOT="/Applications/Godot.app/Contents/MacOS/Godot"
- {
- "name": "๐งช Debug Tests",
- "type": "coreclr",
- "request": "launch",
- "preLaunchTask": "build",
- "program": "${env:GODOT}",
- "args": [
- // These command line flags are used by GoDotTest to run tests.
- "--headless",
- "--run-tests",
- "--quit-on-finish"
- ],
- "cwd": "${workspaceFolder}/Chickensoft.GoDotCollections.Tests",
- "stopAtEntry": false,
- },
- {
- "name": "๐ฌ Debug Current Test",
- "type": "coreclr",
- "request": "launch",
- "preLaunchTask": "build",
- "program": "${env:GODOT}",
- "args": [
- // These command line flags are used by GoDotTest to run tests.
- "--headless",
- "--run-tests=${fileBasenameNoExtension}",
- "--quit-on-finish"
- ],
- "cwd": "${workspaceFolder}/Chickensoft.GoDotCollections.Tests",
- "stopAtEntry": false,
- },
- ]
-}
diff --git a/.vscode/settings.json b/.vscode/settings.json
index e377ecc..a1122a2 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -132,14 +132,13 @@
// Allow html in markdown.
"MD033": false,
// Allow non-unique heading names so we don't break the changelog.
- "MD024": false
+ "MD024": false,
},
- "markdownlint.ignore": [
- "**/LICENSE"
+ "markdownlint.lintWorkspaceGlobs": [
+ "!**/LICENSE"
],
"omnisharp.enableEditorConfigSupport": true,
"omnisharp.enableMsBuildLoadProjectsOnDemand": false,
- "omnisharp.enableRoslynAnalyzers": true,
"omnisharp.maxFindSymbolsItems": 3000,
"omnisharp.organizeImportsOnFormat": true,
"omnisharp.useModernNet": true,
@@ -163,4 +162,4 @@
}
},
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true
-}
+}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index b0345d0..1f90a02 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -22,10 +22,10 @@
{
"label": "coverage",
"group": "test",
- "command": "${workspaceFolder}/Chickensoft.GoDotCollections.Tests/coverage.sh",
+ "command": "${workspaceFolder}/Chickensoft.Collections.Tests/coverage.sh",
"type": "shell",
"options": {
- "cwd": "${workspaceFolder}/Chickensoft.GoDotCollections.Tests"
+ "cwd": "${workspaceFolder}/Chickensoft.Collections.Tests"
},
"presentation": {
"echo": true,
@@ -35,23 +35,6 @@
"showReuseMessage": false,
"clear": true
},
- },
- {
- "label": "build-solutions",
- "group": "test",
- "command": "dotnet restore; ${env:GODOT} --headless --build-solutions --quit || exit 0",
- "type": "shell",
- "options": {
- "cwd": "${workspaceFolder}/Chickensoft.GoDotCollections.Tests"
- },
- "presentation": {
- "echo": true,
- "reveal": "silent",
- "focus": false,
- "panel": "shared",
- "showReuseMessage": false,
- "clear": false
- }
- },
+ }
]
-}
+}
\ No newline at end of file
diff --git a/Chickensoft.Collections.Tests.sln b/Chickensoft.Collections.Tests.sln
new file mode 100644
index 0000000..4b5e4dc
--- /dev/null
+++ b/Chickensoft.Collections.Tests.sln
@@ -0,0 +1,28 @@
+๏ปฟ
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31903.59
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chickensoft.Collections", "Chickensoft.Collections\Chickensoft.Collections.csproj", "{4789AFE1-321A-4D01-877D-59FAE5C8E666}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chickensoft.Collections.Tests", "Chickensoft.Collections.Tests\Chickensoft.Collections.Tests.csproj", "{C6729B76-21EB-4C52-87EF-B1F8DA06673D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4789AFE1-321A-4D01-877D-59FAE5C8E666}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4789AFE1-321A-4D01-877D-59FAE5C8E666}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4789AFE1-321A-4D01-877D-59FAE5C8E666}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4789AFE1-321A-4D01-877D-59FAE5C8E666}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C6729B76-21EB-4C52-87EF-B1F8DA06673D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C6729B76-21EB-4C52-87EF-B1F8DA06673D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C6729B76-21EB-4C52-87EF-B1F8DA06673D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C6729B76-21EB-4C52-87EF-B1F8DA06673D}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/Chickensoft.Collections.Tests/Chickensoft.Collections.Tests.csproj b/Chickensoft.Collections.Tests/Chickensoft.Collections.Tests.csproj
new file mode 100644
index 0000000..6b61756
--- /dev/null
+++ b/Chickensoft.Collections.Tests/Chickensoft.Collections.Tests.csproj
@@ -0,0 +1,39 @@
+
+
+ net8.0
+ disable
+ enable
+
+ false
+ true
+ preview
+ portable
+
+
+ true
+ .generated
+
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
+
+
diff --git a/Chickensoft.GoDotCollections.Tests/badges/branch_coverage.svg b/Chickensoft.Collections.Tests/badges/branch_coverage.svg
similarity index 100%
rename from Chickensoft.GoDotCollections.Tests/badges/branch_coverage.svg
rename to Chickensoft.Collections.Tests/badges/branch_coverage.svg
diff --git a/Chickensoft.GoDotCollections.Tests/badges/line_coverage.svg b/Chickensoft.Collections.Tests/badges/line_coverage.svg
similarity index 100%
rename from Chickensoft.GoDotCollections.Tests/badges/line_coverage.svg
rename to Chickensoft.Collections.Tests/badges/line_coverage.svg
diff --git a/Chickensoft.Collections.Tests/coverage.sh b/Chickensoft.Collections.Tests/coverage.sh
new file mode 100755
index 0000000..3819fb3
--- /dev/null
+++ b/Chickensoft.Collections.Tests/coverage.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+dotnet build
+
+dotnet test \
+ -p:CollectCoverage=true \
+ -p:CoverletOutputFormat="opencover" \
+ -p:CoverletOutput=./coverage/
+
+reportgenerator \
+ -reports:"./coverage/coverage.opencover.xml" \
+ -targetdir:"./coverage/report" \
+ "-assemblyfilters:-*Chickensoft.LogicBlocks.Generator*" \
+ -reporttypes:"Html;Badges"
+
+# Copy badges into their own folder. The badges folder should be included in
+# source control so that the README.md in the root can reference the badges.
+
+mkdir -p ./badges
+mv ./coverage/report/badge_branchcoverage.svg ./badges/branch_coverage.svg
+mv ./coverage/report/badge_linecoverage.svg ./badges/line_coverage.svg
+
+# Determine OS, open coverage accordingly.
+
+case "$(uname -s)" in
+
+ Darwin)
+ echo 'Mac OS X'
+ open coverage/report/index.htm
+ ;;
+
+ Linux)
+ echo 'Linux'
+ xdg-open coverage/report/index.htm
+ ;;
+
+ CYGWIN*|MINGW32*|MSYS*|MINGW*)
+ echo 'MS Windows'
+ start coverage/report/index.htm
+ ;;
+
+ *)
+ echo 'Other OS'
+ ;;
+esac
diff --git a/Chickensoft.GoDotCollections.Tests/test/src/AutoPropTest.cs b/Chickensoft.Collections.Tests/src/AutoPropTest.cs
similarity index 91%
rename from Chickensoft.GoDotCollections.Tests/test/src/AutoPropTest.cs
rename to Chickensoft.Collections.Tests/src/AutoPropTest.cs
index f54bf1d..ab901c7 100644
--- a/Chickensoft.GoDotCollections.Tests/test/src/AutoPropTest.cs
+++ b/Chickensoft.Collections.Tests/src/AutoPropTest.cs
@@ -1,15 +1,12 @@
-namespace Chickensoft.GoDotCollections.Tests;
+namespace Chickensoft.Collections.Tests;
using System;
using System.Collections.Generic;
-using Godot;
-using GoDotCollections;
-using GoDotTest;
+using Chickensoft.Collections;
using Shouldly;
+using Xunit;
-public class NotifierTest : TestClass {
- public NotifierTest(Node testScene) : base(testScene) { }
-
+public class NotifierTest {
public static class Utils {
public static void ClearWeakReference(WeakReference weakReference) {
weakReference.Target = null;
@@ -22,20 +19,20 @@ public static void ClearWeakReference(WeakReference weakReference) {
new AutoProp(1)
);
- [Test]
+ [Fact]
public void Initializes() {
var subject = new AutoProp(1);
subject.Value.ShouldBe(1);
}
- [Test]
+ [Fact]
public void InitializesWithComparer() {
var subject = new AutoProp(1, EqualityComparer.Default);
subject.Value.ShouldBe(1);
subject.Comparer.ShouldBe(EqualityComparer.Default);
}
- [Test]
+ [Fact]
public void SyncCallsHandlerImmediatelyAndAllowsUnsubscribe() {
using var subject = new AutoProp(1);
@@ -59,7 +56,7 @@ void onSync(int value) {
changedCalled.ShouldBe(1);
}
- [Test]
+ [Fact]
public void ClearsEventHandlers() {
using var subject = new AutoProp(1);
@@ -85,7 +82,7 @@ public void ClearsEventHandlers() {
errorCalled.ShouldBe(0);
}
- [Test]
+ [Fact]
public void CompletesAndBlocksOtherActions() {
using var subject = new AutoProp(1);
@@ -111,7 +108,7 @@ public void CompletesAndBlocksOtherActions() {
errorCalled.ShouldBe(0);
}
- [Test]
+ [Fact]
public void CallsErrorHandler() {
using var subject = new AutoProp(1);
@@ -133,7 +130,7 @@ void onError(Exception exception) {
errorCalled.ShouldBe(1);
}
- [Test]
+ [Fact]
public void DisposesCorrectly() {
var subject = new AutoProp(1);
@@ -160,7 +157,7 @@ public void DisposesCorrectly() {
errorCalled.ShouldBe(0);
}
- [Test]
+ [Fact]
public void Finalizes() {
// Weak reference has to be created and cleared from a static function
// or else the GC won't ever collect it :P
@@ -168,7 +165,7 @@ public void Finalizes() {
Utils.ClearWeakReference(subject);
}
- [Test]
+ [Fact]
public void DoesNotCallHandlersIfValueHasNotChanged() {
var subject = new AutoProp(1);
@@ -185,7 +182,7 @@ public void DoesNotCallHandlersIfValueHasNotChanged() {
syncCalled.ShouldBe(2);
}
- [Test]
+ [Fact]
public void DoesNotCallHandlerWhileInsideHandler() {
var subject = new AutoProp(1);
@@ -196,11 +193,11 @@ public void DoesNotCallHandlerWhileInsideHandler() {
changes.Add(value);
subject.OnNext(3);
};
- subject.Sync += (value) => syncs.Add(value);
+ subject.Sync += syncs.Add;
subject.OnNext(2);
- changes.ShouldBe(new[] { 2, 3 });
- syncs.ShouldBe(new[] { 1, 2, 3 });
+ changes.ShouldBe([2, 3]);
+ syncs.ShouldBe([1, 2, 3]);
}
}
diff --git a/Chickensoft.Collections.Tests/src/BlackboardTest.cs b/Chickensoft.Collections.Tests/src/BlackboardTest.cs
new file mode 100644
index 0000000..869d843
--- /dev/null
+++ b/Chickensoft.Collections.Tests/src/BlackboardTest.cs
@@ -0,0 +1,35 @@
+namespace Chickensoft.Collections.Tests;
+
+using System.Collections.Generic;
+using System.Data;
+using Shouldly;
+using Xunit;
+
+public class BlackboardTest {
+ [Fact]
+ public void SetsAndGetsData() {
+ var blackboard = new Blackboard();
+ blackboard.Has().ShouldBeFalse();
+ blackboard.HasObject(typeof(string)).ShouldBeFalse();
+ blackboard.Set("data");
+ blackboard.Has().ShouldBeTrue();
+ blackboard.HasObject(typeof(string)).ShouldBeTrue();
+ blackboard.Get().ShouldBe("data");
+ blackboard.GetObject(typeof(string)).ShouldBe("data");
+ blackboard.Overwrite("string");
+ blackboard.Get().ShouldBe("string");
+ blackboard.OverwriteObject(typeof(string), "overwritten");
+ blackboard.GetObject(typeof(string)).ShouldBe("overwritten");
+ blackboard.SetObject(typeof(int), 5);
+ blackboard.GetObject(typeof(int)).ShouldBe(5);
+
+ blackboard.Types.ShouldBe([typeof(string), typeof(int)], ignoreOrder: true);
+
+ // Can't change values once set.
+ Should.Throw(() => blackboard.Set("other"));
+ Should.Throw(() => blackboard.Get());
+ Should.Throw(
+ () => blackboard.GetObject(typeof(string[]))
+ );
+ }
+}
diff --git a/Chickensoft.GoDotCollections.Tests/test/src/MapTest.cs b/Chickensoft.Collections.Tests/src/MapTest.cs
similarity index 55%
rename from Chickensoft.GoDotCollections.Tests/test/src/MapTest.cs
rename to Chickensoft.Collections.Tests/src/MapTest.cs
index 1177f65..8649c1d 100644
--- a/Chickensoft.GoDotCollections.Tests/test/src/MapTest.cs
+++ b/Chickensoft.Collections.Tests/src/MapTest.cs
@@ -1,55 +1,53 @@
-namespace Chickensoft.GoDotCollections.Tests;
+namespace Chickensoft.Collections.Tests;
using System.Collections;
using System.Collections.Generic;
-using Godot;
-using GoDotCollections;
-using GoDotTest;
using Shouldly;
+using Xunit;
-public class MapTest : TestClass {
- public MapTest(Node testScene) : base(testScene) { }
-
- [Test]
+public class MapTest {
+ [Fact]
public void Initializes()
=> new Map().ShouldBeOfType