| 1 |
using System.Threading.Tasks; |
| 2 |
using Xunit; |
| 3 |
|
| 4 |
namespace Godot.SourceGenerators.Tests; |
| 5 |
|
| 6 |
public class ScriptPropertiesGeneratorTests |
| 7 |
{ |
| 8 |
[Fact] |
| 9 |
public async Task ExportedFields() |
| 10 |
{ |
| 11 |
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify( |
| 12 |
new string[] { "ExportedFields.cs", "MoreExportedFields.cs" }, |
| 13 |
new string[] { "ExportedFields_ScriptProperties.generated.cs" } |
| 14 |
); |
| 15 |
} |
| 16 |
|
| 17 |
[Fact] |
| 18 |
public async Task ExportedProperties() |
| 19 |
{ |
| 20 |
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify( |
| 21 |
"ExportedProperties.cs", |
| 22 |
"ExportedProperties_ScriptProperties.generated.cs" |
| 23 |
); |
| 24 |
} |
| 25 |
|
| 26 |
[Fact] |
| 27 |
public async Task OneWayPropertiesAllReadOnly() |
| 28 |
{ |
| 29 |
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify( |
| 30 |
"AllReadOnly.cs", |
| 31 |
"AllReadOnly_ScriptProperties.generated.cs" |
| 32 |
); |
| 33 |
} |
| 34 |
|
| 35 |
[Fact] |
| 36 |
public async Task OneWayPropertiesAllWriteOnly() |
| 37 |
{ |
| 38 |
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify( |
| 39 |
"AllWriteOnly.cs", |
| 40 |
"AllWriteOnly_ScriptProperties.generated.cs" |
| 41 |
); |
| 42 |
} |
| 43 |
|
| 44 |
[Fact] |
| 45 |
public async Task OneWayPropertiesMixedReadOnlyWriteOnly() |
| 46 |
{ |
| 47 |
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify( |
| 48 |
"MixedReadOnlyWriteOnly.cs", |
| 49 |
"MixedReadOnlyWriteOnly_ScriptProperties.generated.cs" |
| 50 |
); |
| 51 |
} |
| 52 |
|
| 53 |
[Fact] |
| 54 |
public async Task ScriptBoilerplate() |
| 55 |
{ |
| 56 |
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify( |
| 57 |
"ScriptBoilerplate.cs", |
| 58 |
"ScriptBoilerplate_ScriptProperties.generated.cs", "OuterClass.NestedClass_ScriptProperties.generated.cs" |
| 59 |
); |
| 60 |
} |
| 61 |
|
| 62 |
[Fact] |
| 63 |
public async Task AbstractGenericNode() |
| 64 |
{ |
| 65 |
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify( |
| 66 |
"AbstractGenericNode.cs", |
| 67 |
"AbstractGenericNode(Of T)_ScriptProperties.generated.cs" |
| 68 |
); |
| 69 |
} |
| 70 |
|
| 71 |
[Fact] |
| 72 |
public async Task ExportedButtons() |
| 73 |
{ |
| 74 |
await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify( |
| 75 |
"ExportedToolButtons.cs", |
| 76 |
"ExportedToolButtons_ScriptProperties.generated.cs" |
| 77 |
); |
| 78 |
} |
| 79 |
} |