Add tests and fix exports diagnostics

- Add tests for the following diagnostics: GD0101, GD0102, GD0103, GD0104, GD0105, GD0106, GD0107.
- Fix GD0101 not being reported any more (was filtering static classes before reporting).
- Fix GD0107 not preventing `Node` members from being exported from not-`Node` types.
This commit is contained in:
Paul Joannon
2024-02-18 14:40:31 +01:00
parent b7145638d5
commit 88ad4e6c24
19 changed files with 242 additions and 9 deletions
@@ -0,0 +1,10 @@
using Godot;
public partial class ExportDiagnostics_GD0101 : Node
{
[Export]
public static string {|GD0101:StaticField|};
[Export]
public static int {|GD0101:StaticProperty|} { get; set; }
}
@@ -0,0 +1,12 @@
using Godot;
public partial class ExportDiagnostics_GD0102 : Node
{
public struct MyStruct { }
[Export]
public MyStruct {|GD0102:StructField|};
[Export]
public MyStruct {|GD0102:StructProperty|} { get; set; }
}
@@ -0,0 +1,10 @@
using Godot;
public partial class ExportDiagnostics_GD0103 : Node
{
[Export]
public readonly string {|GD0103:ReadOnlyField|};
[Export]
public string {|GD0103:ReadOnlyProperty|} { get; }
}
@@ -0,0 +1,7 @@
using Godot;
public partial class ExportDiagnostics_GD0104 : Node
{
[Export]
public string {|GD0104:WriteOnlyProperty|} { set { } }
}
@@ -0,0 +1,12 @@
using System;
using Godot;
public partial class ExportDiagnostics_GD0105 : Node
{
[Export]
public int {|GD0105:this|}[int index]
{
get { return index; }
set { }
}
}
@@ -0,0 +1,18 @@
using Godot;
public interface MyInterface
{
public int MyProperty { get; set; }
}
public partial class ExportDiagnostics_GD0106_OK : Node, MyInterface
{
[Export]
public int MyProperty { get; set; }
}
public partial class ExportDiagnostics_GD0106_KO : Node, MyInterface
{
[Export]
int MyInterface.{|GD0106:MyProperty|} { get; set; }
}
@@ -0,0 +1,19 @@
using Godot;
public partial class ExportDiagnostics_GD0107_OK : Node
{
[Export]
public Node NodeField;
[Export]
public Node NodeProperty { get; set; }
}
public partial class ExportDiagnostics_GD0107_KO : Resource
{
[Export]
public Node {|GD0107:NodeField|};
[Export]
public Node {|GD0107:NodeProperty|} { get; set; }
}