Skip to content

Commit 04fb986

Browse files
committed
Adding tests
1 parent 72179b8 commit 04fb986

10 files changed

Lines changed: 54 additions & 4 deletions

File tree

CustomGeneratorTests/CustomGeneratorTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
77
</PropertyGroup>
88
<ItemGroup>
9-
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.3.4-240423-1409.Release" PrivateAssets="all" />
9+
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.3.4-240424-1056.Release" PrivateAssets="all" />
1010
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" PrivateAssets="all" />
1111
</ItemGroup>
1212
</Project>

Godot 3 Tests/Godot 3 Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</ItemGroup>
1010
<ItemGroup>
1111
<PackageReference Include="FluentAssertions" Version="6.12.0" />
12-
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.3.4-240423-1409.Release" />
12+
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.3.4-240424-1056.Release" />
1313
</ItemGroup>
1414
<ItemGroup>
1515
<ProjectReference Include="..\CustomGeneratorTests\CustomGeneratorTests.csproj" OutputItemType="analyzer" />

Godot 3 Tests/Run.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ private static IEnumerable<Func<ITest>> Tests
4444
yield return ITest.GetTest<ScriptForSceneWithDifferentName>;
4545
yield return ITest.GetTest<ScriptForSceneWithDifferentPath>;
4646
yield return ITest.GetTest<TraverseInstancedScene>;
47+
yield return ITest.GetTest<TypeNameCaseMismatchTest>;
4748
yield return ITest.GetTest<UniqueSceneNameAccessTest>;
4849
yield return ITest.GetTest<UnsupportedInheritedOverride>;
4950
yield return ITest.GetTest<UnsupportedInstancedOverride>;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Godot;
2+
using GodotSharp.BuildingBlocks.TestRunner;
3+
4+
namespace GodotTests.TestScenes
5+
{
6+
[SceneTree]
7+
public partial class TypeNameCaseMismatchTest : Node, ITest
8+
{
9+
void ITest.InitTests()
10+
{
11+
// NB: There is no case mismatch in GD3
12+
}
13+
}
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[gd_scene load_steps=2 format=2]
2+
3+
[ext_resource path="res://TestScenes/Issue55.TypeNameCaseMismatch/TypeNameCaseMismatchTest.cs" type="Script" id=1]
4+
5+
[node name="Node" type="Node"]
6+
script = ExtResource( 1 )
7+
8+
[node name="CPUParticles" type="CPUParticles" parent="."]
9+
unique_name_in_owner = true

Godot 4 Tests/Godot 4 Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212
<ItemGroup>
1313
<PackageReference Include="FluentAssertions" Version="6.12.0" />
14-
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.3.4-240423-1409.Release" />
14+
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.3.4-240424-1056.Release" />
1515
</ItemGroup>
1616
<ItemGroup>
1717
<ProjectReference Include="..\CustomGeneratorTests\CustomGeneratorTests.csproj" OutputItemType="analyzer" />

Godot 4 Tests/Run.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ private static IEnumerable<Func<ITest>> Tests
4747
yield return ITest.GetTest<ScriptForSceneWithDifferentName>;
4848
yield return ITest.GetTest<ScriptForSceneWithDifferentPath>;
4949
yield return ITest.GetTest<TraverseInstancedScene>;
50+
yield return ITest.GetTest<TypeNameCaseMismatchTest>;
5051
yield return ITest.GetTest<UniqueSceneNameAccessTest>;
5152
yield return ITest.GetTest<UnsupportedInheritedOverride>;
5253
yield return ITest.GetTest<UnsupportedInstancedOverride>;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Godot;
2+
using GodotSharp.BuildingBlocks.TestRunner;
3+
4+
namespace GodotTests.TestScenes
5+
{
6+
[SceneTree]
7+
public partial class TypeNameCaseMismatchTest : Node, ITest
8+
{
9+
// Native name: GPUParticles3D
10+
// C# name: GpuParticles3D
11+
void ITest.InitTests()
12+
{
13+
// If it compiles, test passes
14+
}
15+
}
16+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[gd_scene load_steps=2 format=3 uid="uid://fjr3kef6l4h4"]
2+
3+
[ext_resource type="Script" path="res://TestScenes/Issue55.TypeNameCaseMismatch/TypeNameCaseMismatchTest.cs" id="1_m7duv"]
4+
5+
[node name="Root" type="Node"]
6+
script = ExtResource("1_m7duv")
7+
8+
[node name="Particles" type="GPUParticles3D" parent="."]
9+
unique_name_in_owner = true

SourceGenerators/Utilities/Log.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ internal static class Log
1111
public static bool EnableFileName { get; set; } = true;
1212
public static bool EnableMemberName { get; set; } = false;
1313

14-
//[Conditional("DEBUG")]
14+
[Conditional("DEBUG")]
1515
public static void Debug(object msg = null, [CallerFilePath] string filePath = null, [CallerMemberName] string memberName = null) => Print(Format(filePath, memberName, msg));
1616
public static void Info(object msg = null, [CallerFilePath] string filePath = null, [CallerMemberName] string memberName = null) => Print(Format(filePath, memberName, $"[INFO] {msg}"));
1717
public static void Warn(object msg = null, [CallerFilePath] string filePath = null, [CallerMemberName] string memberName = null) => Print(Format(filePath, memberName, $"[WARN] {msg}"));

0 commit comments

Comments
 (0)