-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Unit Test Framework #30743
Unit Test Framework #30743
Conversation
f373889
to
1942bde
Compare
Rebased and removed requested items, also edited readme.md to use proper capitalization. |
I believe doctest is not very popular, it's developed by just one guy, and relies on undefined behaviour. |
@starry-abyss I was advised to not separate them and I believe that unit tests should be executable from the main executable as intended by the godot developers. This is the default behavior of the engine. Please advise how doctest is unpopular, hacky and only developed by one guy? with examples. Furthermore: it has 31 contributors so I don't understand how 'one guy' is equal to 31 contributors. Static analysis rates the code quality higher than godot. It isn't relying on undefined behavior and this requires further explanation. |
a47c843
to
c3d2edd
Compare
After this is all working I will re-base my commits to only include the finished code. |
Travis errors are because noexcept specifier. You suppress it for MSVC here https://github.com/godotengine/godot/blob/7c788945a20a315d9f5e8c955f70d2bbee09f18a/thirdparty/doctest/doctest.h#L3224 but I couldn't find it for gcc. Maybe add it for gcc too. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
It's ok for libraries to use C++11. If you rebase on current master the codebase builds with C++11 support, so it should work fine. |
@akien-mga okay, if that's now allowed I will do a rebase and restore the latest version of the library since C++11 is now enabled and usable. |
a043f98
to
c001c75
Compare
Conflict because of new string method #25090 test case 35. I will port this test soon. |
3039270
to
f52166d
Compare
Next patch adds backward compatibility for existing tests written in pure C++ rather than with doctest. new arguments are as follows: Already planning on supporting the doctest arguments properly but this will take some time to do. |
f52166d
to
717a3df
Compare
@akien-mga please can you review this? |
This looks good to me, it will simplify test writing a bit so maybe we will get more. And the header is tiny. |
Also rewritten string tests in this library
1895356
to
9755a37
Compare
FWIW, in case anyone ends up here via a search for Catch2 & Godot or GDNative... I recently integrated Catch2 into a GDNative module for someone who was trying to "run Godot code outside Godot" but had run into issues. The example repository is here:
|
@RevoluPowered Is this still desired? If so, due to the size of this feature, you should open a proposal which explains example use cases and how this approach will solve the problem. |
We discussed at length with reduz and akien and it was to be merged for 4.0 (at godot con), we are looking to see if another route is practical for 4.0, doctest is still better than no test framework for core, so I was looking for a way around the shared libraries not working for test discovery. I understand the need for a proposal but this was pre-proposal godot and approved at godotcon |
Yes, but if formalized as a proposal, it also allows you/reduz/akien to organize your thoughts in one place, and it gives everyone a chance to pitch in to the discussion. Having a proposal is more than just deciding whether or not it should be approved. For this topic, there are many approaches and therefore it's worth discussing openly with the community to collect ideas. Writing a proposal also forces you to think in the context of best practices for engine contributors. |
If I get free time I will open a proposal, I'll need to abandon this PR in favor of prioritizing FBX, too much work to go through another iteration right now, sorry got no free time. |
|
What needs to be done to salvage this? |
@neikeq in order to make this PR work we need to update doctest and rebase on 4.0, older version would literally not build on OSX so this is now fixed in the latest doctest. I will update the PR, and see if it works, hopefully its 'okay' really I got blocked by the static libs not working cross core/modules which was the main contention point really (it wasn't practical) however this could work if the latest version fixes the issue. |
Superseded by #40148. |
This uses doctest and doesn't use Catch2, this was because I was advised that Catch2 would severely decrease build performance.
This includes the following:
Benefits
Current test runner can be executed by running ./bin/godot.x11.tools.64 --test doctest
please note: doctest specific arguments not handled yet, but are not required to make this work #26213
Demo with
--test doctest
argumentDemo with backward compatibility with other core tests
--test math