spiegel-keyman/core/tests/unit/helpers/main.cpp
Marc Durdin d61e5bbb18 refactor(core): clean up unit tests
Consolidate test frameworks and cleanup, including:
* all tests use Google Test
* reorganize folders, esp. kmnkbd -> api
* move all api tests into api folder
* replace references to test_assert or test_color with gtest equivalents
* leverage gtest patterns to remove boilerplate code
* dramatically simplify meson.build files and localize variables
* move shared helper code into helpers/ folder
* make test names unique and add gtest protocol for reporting back to
  teamcity

Fixes:
* CLDR test keyboards had invalid unicodeset escapes (needs to be raised
  upstream also) - was not failing tests because files were not loading
  but returning success

Test-bot: skip
2026-04-28 12:17:44 +02:00

31 lines
925 B
C++

/*
* Keyman is copyright (C) SIL International. MIT License.
*
* Keyman Core - Standard main() for gtest unit tests
*/
#include "./core_test_helpers.h"
//-------------------------------------------------------------------------------------
// Launcher
//-------------------------------------------------------------------------------------
km::core::path test_dir;
// provide our own `main` so that we can get the path of the exe so that
// we have a well-defined location to find our test keyboards
GTEST_API_ int
main(int argc, char **argv) {
#ifdef __EMSCRIPTEN__
if(!get_wasm_file_path(km::core::path(argv[0]).parent(), test_dir)) {
// not a fully qualified path
return 1;
}
#else
test_dir = km::core::path(argv[0]).parent();
#endif
std::cout << "test_dir=" << std::string(test_dir) << std::endl;
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}