spiegel-keyman/core/tests/unit/helpers/main.cpp
Marc Durdin 08891bb3a2 chore(core): address review comments on unit tests
Test-bot: skip
Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
2026-05-06 12:09:19 +02:00

32 lines
1,011 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
std::cout << "Error: argv[0] did not give a fully qualified path!" << std::endl;
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();
}