mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-24 07:53:41 +03:00
Small refactor in unit tests
This commit is contained in:
parent
ccfb87ecf3
commit
41319d2708
@ -370,7 +370,7 @@ int run_server(StringView session, StringView init_command,
|
|||||||
FaceRegistry face_registry;
|
FaceRegistry face_registry;
|
||||||
ClientManager client_manager;
|
ClientManager client_manager;
|
||||||
|
|
||||||
run_unit_tests();
|
UnitTest::run_all_tests();
|
||||||
|
|
||||||
register_options();
|
register_options();
|
||||||
register_env_vars();
|
register_env_vars();
|
||||||
|
@ -42,11 +42,11 @@ UnitTest test_diff{[]()
|
|||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
|
|
||||||
UnitTest* unit_tests;
|
UnitTest* UnitTest::list = nullptr;
|
||||||
|
|
||||||
void run_unit_tests()
|
void UnitTest::run_all_tests()
|
||||||
{
|
{
|
||||||
for (const UnitTest* test = unit_tests; test; test = test->next)
|
for (const UnitTest* test = UnitTest::list; test; test = test->next)
|
||||||
test->func();
|
test->func();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,17 +4,15 @@
|
|||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
struct UnitTest;
|
|
||||||
extern UnitTest* unit_tests;
|
|
||||||
|
|
||||||
struct UnitTest
|
struct UnitTest
|
||||||
{
|
{
|
||||||
UnitTest(void (*func)()) : func(func), next(unit_tests) { unit_tests = this; }
|
UnitTest(void (*func)()) : func(func), next(list) { list = this; }
|
||||||
void (*func)();
|
void (*func)();
|
||||||
const UnitTest* next;
|
const UnitTest* next;
|
||||||
};
|
|
||||||
|
|
||||||
void run_unit_tests();
|
static void run_all_tests();
|
||||||
|
static UnitTest* list;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user