ScriptPropertiesGeneratorTests.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using Xunit;
  2. namespace Godot.SourceGenerators.Tests;
  3. public class ScriptPropertiesGeneratorTests
  4. {
  5. [Fact]
  6. public async void ExportedFields()
  7. {
  8. await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify(
  9. new string[] { "ExportedFields.cs", "MoreExportedFields.cs" },
  10. new string[] { "ExportedFields_ScriptProperties.generated.cs" }
  11. );
  12. }
  13. [Fact]
  14. public async void ExportedProperties()
  15. {
  16. await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify(
  17. "ExportedProperties.cs",
  18. "ExportedProperties_ScriptProperties.generated.cs"
  19. );
  20. }
  21. [Fact]
  22. public async void OneWayPropertiesAllReadOnly()
  23. {
  24. await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify(
  25. "AllReadOnly.cs",
  26. "AllReadOnly_ScriptProperties.generated.cs"
  27. );
  28. }
  29. [Fact]
  30. public async void OneWayPropertiesAllWriteOnly()
  31. {
  32. await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify(
  33. "AllWriteOnly.cs",
  34. "AllWriteOnly_ScriptProperties.generated.cs"
  35. );
  36. }
  37. [Fact]
  38. public async void OneWayPropertiesMixedReadonlyWriteOnly()
  39. {
  40. await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify(
  41. "MixedReadOnlyWriteOnly.cs",
  42. "MixedReadOnlyWriteOnly_ScriptProperties.generated.cs"
  43. );
  44. }
  45. [Fact]
  46. public async void ScriptBoilerplate()
  47. {
  48. await CSharpSourceGeneratorVerifier<ScriptPropertiesGenerator>.Verify(
  49. "ScriptBoilerplate.cs",
  50. "ScriptBoilerplate_ScriptProperties.generated.cs", "OuterClass.NestedClass_ScriptProperties.generated.cs"
  51. );
  52. }
  53. }