Skip to content

Commit

Permalink
refactor: replace GoDotLog with Chickensoft.Log
Browse files Browse the repository at this point in the history
* Bump .NET to v8
* Replace PackageReference to GoDotLog with new
  Chickensoft.Log
* Replace usings GoDotLog -> Chickensoft.Log
* Replace GDLog with Log and a TraceWriter to
  support output in VSCode, VS, and Godot
* Add logic to GoTest to optionally add a
  DefaultTraceListener before running tests and
  to always remove it as the last step of
  execution (prevents multiple
  DefaultTraceListeners if multiple calls to
  GoTest.RunTests() happen)
* Add logic to TestEnvironment for a command-line
  option that skips adding the
  DefaultTraceListener (useful for VSCode, which
  picks up Trace output without the
  DefaultTraceListener)
  • Loading branch information
wlsnmrk committed Feb 3, 2025
1 parent 427fd9a commit 449e7b0
Show file tree
Hide file tree
Showing 13 changed files with 179 additions and 92 deletions.
2 changes: 2 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"args": [
// These command line flags are used by GoDotTest to run tests.
"--run-tests",
// VS needs an additional trace listener, VSCode doesn't
"--suppress-trace",
"--quit-on-finish"
],
"cwd": "${workspaceFolder}/Chickensoft.GoDotTest.Tests",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Godot.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
Expand Down
57 changes: 41 additions & 16 deletions Chickensoft.GoDotTest.Tests/badges/branch_coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 41 additions & 16 deletions Chickensoft.GoDotTest.Tests/badges/line_coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Chickensoft.GoDotTest.Tests/test/src/GoTestTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ namespace Chickensoft.GoDotTest.Tests;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using Chickensoft.Log;
using Godot;
using GoDotLog;
using GoDotTest;
using LightMock;
using LightMock.Generator;
Expand Down
2 changes: 1 addition & 1 deletion Chickensoft.GoDotTest.Tests/test/src/TestAdapterTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Chickensoft.GoDotTest.Tests;

using Chickensoft.Log;
using Godot;
using GoDotLog;
using GoDotTest;
using LightMock.Generator;
using Shouldly;
Expand Down
16 changes: 10 additions & 6 deletions Chickensoft.GoDotTest.Tests/test/src/TestEnvironmentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,28 @@ namespace Chickensoft.GoDotTest.Tests;
public class TestEnvironmentTest : TestClass {
public TestEnvironmentTest(Node testScene) : base(testScene) { }

private static readonly string[] _commandLineArgs = new string[] {
"--run-tests=SomeTest"
};

[Test]
public void ConstructsTestEnvironmentWithPatternFlag() {
var testEnvironment = TestEnvironment.From(new string[] {
"--run-tests=SomeTest"
});
var testEnvironment = TestEnvironment.From(_commandLineArgs);
testEnvironment.TestPatternToRun.ShouldBe("SomeTest");
}

[Test]
public void ConstructsTestEnvironmentWithSimpleFlags() {
var args = new string[] {
"--quit-on-finish",
"--stop-on-error",
"--sequential",
"--coverage",
"--suppress-trace",
"--stop-on-error",
"--sequential",
"--coverage",
};
var testEnvironment = TestEnvironment.From(args);
testEnvironment.QuitOnFinish.ShouldBeTrue();
testEnvironment.SuppressTrace.ShouldBeTrue();
testEnvironment.StopOnError.ShouldBeTrue();
testEnvironment.Sequential.ShouldBeTrue();
testEnvironment.Coverage.ShouldBeTrue();
Expand Down
Loading

0 comments on commit 449e7b0

Please sign in to comment.