virtualx-engine/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/ScriptPropertiesGeneratorTests.cs
Paul Joannon 139a5df821
Cleanup C# projects, code quality & style
New rules:
- Do not silence CA1805 any more
- Limit where we silence CA1707, CA1711, CA1720
- Enforce severity=warning for IDE0040
- Enforce Allman style braces
- Enforce naming conventions (IDE1006 is still severity=suggestion)

Fixes:
- Fix REFL045, CS1572, CS1573
- Suppress CS0618 when generating `InvokeGodotClassMethod`
- Fix indent when generating GD_constants.cs
- Temporarily silence CS1734 in generated code
- Fix a lot of naming rule violations

Misc.:
- Remove ReSharper comments for RedundantNameQualifier
- Remove suppression attributes for RedundantNameQualifier
- Remove severity=warnings for CA1716, CA1304 (already included in the level of analysis we run)
2024-02-27 20:11:24 +01:00

60 lines
1.7 KiB
C#

using Xunit;
namespace Godot.SourceGenerators.Tests;
public class ScriptPropertiesGeneratorTests
{
[Fact]
public async void ExportedFields()
{
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify(
new string[] { "ExportedFields.cs", "MoreExportedFields.cs" },
new string[] { "ExportedFields_ScriptProperties.generated.cs" }
);
}
[Fact]
public async void ExportedProperties()
{
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify(
"ExportedProperties.cs",
"ExportedProperties_ScriptProperties.generated.cs"
);
}
[Fact]
public async void OneWayPropertiesAllReadOnly()
{
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify(
"AllReadOnly.cs",
"AllReadOnly_ScriptProperties.generated.cs"
);
}
[Fact]
public async void OneWayPropertiesAllWriteOnly()
{
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify(
"AllWriteOnly.cs",
"AllWriteOnly_ScriptProperties.generated.cs"
);
}
[Fact]
public async void OneWayPropertiesMixedReadOnlyWriteOnly()
{
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify(
"MixedReadOnlyWriteOnly.cs",
"MixedReadOnlyWriteOnly_ScriptProperties.generated.cs"
);
}
[Fact]
public async void ScriptBoilerplate()
{
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify(
"ScriptBoilerplate.cs",
"ScriptBoilerplate_ScriptProperties.generated.cs", "OuterClass.NestedClass_ScriptProperties.generated.cs"
);
}
}