diff options
| author | Maxime Coste <mawww@kakoune.org> | 2024-07-17 22:29:46 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2024-07-21 00:50:02 +1000 |
| commit | a5ba9bb45f368d88a42f08e4d3134e408f81ab05 (patch) | |
| tree | 96898ec3519d2704fd7e17864aab725abff236d7 /src | |
| parent | 011283e4d2579d905738ef8684972071faad1b7e (diff) | |
Disable UnitTest fully in non KAK_DEBUG builds
The code was still compiled and stored in the release executable,
this reduces the optimized binary size.
Diffstat (limited to 'src')
| -rw-r--r-- | src/unit_tests.cc | 2 | ||||
| -rw-r--r-- | src/unit_tests.hh | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/unit_tests.cc b/src/unit_tests.cc index 7c77d508..1f63ff47 100644 --- a/src/unit_tests.cc +++ b/src/unit_tests.cc @@ -43,6 +43,7 @@ UnitTest test_diff{[]() }}; +#ifdef KAK_DEBUG UnitTest* UnitTest::list = nullptr; void UnitTest::run_all_tests() @@ -50,5 +51,6 @@ void UnitTest::run_all_tests() for (const UnitTest* test = UnitTest::list; test; test = test->next) test->func(); } +#endif } diff --git a/src/unit_tests.hh b/src/unit_tests.hh index 16162694..7072d885 100644 --- a/src/unit_tests.hh +++ b/src/unit_tests.hh @@ -6,12 +6,16 @@ namespace Kakoune struct UnitTest { +#ifdef KAK_DEBUG UnitTest(void (*func)()) : func(func), next(list) { list = this; } void (*func)(); const UnitTest* next; static void run_all_tests(); static UnitTest* list; +#else + UnitTest(void (*func)()) {} +#endif }; } |
