Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Unit tests for Mono module (C#) #9968

Closed
Hilderin opened this issue Jun 15, 2024 · 2 comments
Closed

Add Unit tests for Mono module (C#) #9968

Hilderin opened this issue Jun 15, 2024 · 2 comments

Comments

@Hilderin
Copy link

Describe the project you are working on

I'm working on optimizations in the C# interoperability module and I want to be sure I don't break anything.

Describe the problem or limitation you are having in your project

There are no unit test that automatically test the C# integration in Godot. All my tests are manual and it's difficult to spot regressions.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

I suggest adding a test suite for the mono module. This module could be run locally with --test and should be run in the CI pipeline like the other tests preventing regressions.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

I suggest creating a C# project in a sub directory of the mono module. This project is rebuilt at the beginning of the tests (testing the glue and code generator at the same time).
After that, it's a question of creating tests that use CSharpLanguage to test the binding between Godot and C#.

Not all the methods generated needs to be tested since they are generated by code.

To begin, I would suggest tests like:

  • GetGodotClassPropertyValue
  • GetGodotMethodList
  • GetGodotPropertyList
  • HashGodotClassMethod
  • InvokeGodotClassMethod
  • SetGodotClassPropertyValue
  • Signals
  • RestoreGodotObjectData
  • SaveGodotObjectData
  • Tests these with inheritance

If this enhancement will not be used often, can it be worked around with a few lines of script?

I don't think so.

Is there a reason why this should be core and not an add-on in the asset library?

It's part of the engine.

@AThousandShips
Copy link
Member

@Hilderin
Copy link
Author

Wow, I have been working around C# integrated to Godot for a couple of months now, and I just found out about the project Godot.SourceGenerators.Tests in Godot.NET.Sdk.sln.

I'm closing this proposal!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants