Skip to content

Commit

Permalink
Add custom unicode test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ni4 committed Nov 6, 2024
1 parent eeda79b commit 3ba4f35
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/windows-msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ jobs:
- name: Test
run: |
# Change codepage to utf-8
env
cat /d/a/_temp/setup-msys2/msys2.CMD
echo $PATH
echo "Lang:"
Expand All @@ -176,6 +177,7 @@ jobs:
export PYTHONUTF8=1
export PATH="$PWD/build/src/lib:$PATH"
export RNP_LOG_CONSOLE=1
ctest --test-dir build -C Debug --output-on-failure -R rnp_tests.test_windows_unicode || true
ctest --parallel ${{ env.CORES }} --test-dir build -C Debug --output-on-failure -R rnp_tests.test_cli_rnpkeys_unicode
- name: Install
Expand Down
26 changes: 26 additions & 0 deletions src/tests/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,32 @@ TEST_F(rnp_tests, test_cli_rnpkeys_unicode)
#endif
}

TEST_F(rnp_tests, test_windows_unicode)
{
#ifdef _WIN32
std::wstring cmdline_ws = L"D:\\a\\rnp\\rnp\\build\\src\\tests/../rnpkeys/rnpkeys.exe "
L"--list-keys \"\x03C9\x0410@b.com\"";
STARTUPINFOW siw;
ZeroMemory(&siw, sizeof siw);
PROCESS_INFORMATION pi;
ZeroMemory(&pi, sizeof pi);
BOOL res = CreateProcessW(NULL,
(LPWSTR) cmdline_ws.c_str(), // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Handle inheritance
0, // Creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&siw, // Pointer to STARTUPINFO structure
&pi); // Pointer to PROCESS_INFORMATION structure
assert_true(res);
assert_true(WaitForSingleObject(pi.hProcess, INFINITE) == WAIT_OBJECT_0);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
#endif
}

TEST_F(rnp_tests, test_cli_rnp)
{
int ret;
Expand Down

0 comments on commit 3ba4f35

Please sign in to comment.