-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(core): add a test to print out ICU and Unicode version
- Loading branch information
Showing
2 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
Copyright: © 2024 SIL International. | ||
Description: Tests for normalization in the context API. | ||
Create Date: 3 May 2024 | ||
Authors: Steven R. Loomis | ||
History: 3 May 2024 - SRL - Initial implementation. | ||
*/ | ||
|
||
#include <string> | ||
#include "keyman_core.h" | ||
|
||
#include "path.hpp" | ||
#include "action.hpp" | ||
|
||
#include <test_assert.h> | ||
#include "../emscripten_filesystem.h" | ||
#include <unicode/uversion.h> | ||
#include <unicode/uchar.h> | ||
|
||
//------------------------------------------------------------------------------------- | ||
// Unicode version tests | ||
//------------------------------------------------------------------------------------- | ||
|
||
std::string arg_path; | ||
|
||
void test_unicode_versions() { | ||
std::cout << "== " << __FUNCTION__ << std::endl; | ||
|
||
std::cout << "ICU: " << U_ICU_VERSION << std::endl; | ||
std::cout << "Unicode: " << U_UNICODE_VERSION << std::endl; | ||
|
||
} | ||
|
||
void test_all() { | ||
std::cout << "= " << __FUNCTION__ << std::endl; | ||
test_unicode_versions(); | ||
} | ||
|
||
//------------------------------------------------------------------------------------- | ||
// Launcher | ||
//------------------------------------------------------------------------------------- | ||
|
||
constexpr const auto help_str = "\ | ||
test_unicode [--color]\n\ | ||
\n\ | ||
--color Force color output\n"; | ||
|
||
int error_args() { | ||
std::cerr << "test_unicode: Invalid arguments." << std::endl; | ||
std::cout << help_str; | ||
return 1; | ||
} | ||
|
||
int main(int argc, char *argv []) { | ||
auto arg_color = argc > 1 && std::string(argv[1]) == "--color"; | ||
console_color::enabled = console_color::isaterminal() || arg_color; | ||
|
||
// Get the path of the current executable | ||
arg_path = argv[0]; | ||
auto last = arg_path.find_last_of("/\\"); | ||
if(last == std::string::npos) { | ||
std::cerr << "could not parse argv[0]: " << argv[0] << std::endl; | ||
return 1; | ||
} | ||
arg_path.resize(last+1); | ||
|
||
#ifdef __EMSCRIPTEN__ | ||
arg_path = get_wasm_file_path(arg_path); | ||
#endif | ||
|
||
test_all(); | ||
} |