2
0
mirror of https://github.com/boostorg/locale.git synced 2026-01-19 04:22:08 +00:00

Merge pull request #269 from boostorg/coverage

This commit is contained in:
Alexander Grund
2025-11-02 16:40:22 +01:00
committed by GitHub
3 changed files with 38 additions and 12 deletions

View File

@@ -439,7 +439,22 @@ jobs:
- name: Setup ICU
shell: pwsh
run: 'Add-Content $Env:BOOST_ROOT/project-config.jam "path-constant ICU_PATH : `"$($pwd.Path)\ICU`" ;"'
run: |
$icuPath = (Join-Path $pwd "ICU") -replace '\\', '/'
if (-not (Test-Path $icuPath)) {
Write-Error "ICU directory not found at $icuPath"
exit 1
}
Get-ChildItem $icuPath | ForEach-Object { Write-Host " $_" }
Write-Host ""
$jamPath = Join-Path $env:BOOST_ROOT "project-config.jam"
Add-Content $jamPath "path-constant ICU_PATH : `"$icuPath`" ;"
Write-Host "Contents of project-config.jam:"
Get-Content $jamPath | ForEach-Object { Write-Host " $_" }
- name: Run tests (WinAPI, without coverage)
if: '!matrix.coverage'
@@ -478,8 +493,12 @@ jobs:
- name: Show config before collecting coverage
if: matrix.coverage
run: |
type %BOOST_ROOT%\project-config.jam
set B2_TARGETS=libs/%SELF%/test//show_config --verbose-test
ci\build.bat
set B2_FLAGS=--debug-configuration
ci\build.bat || exit /b 1
echo Config log:
type %BOOST_ROOT%/bin.v2/config.log
env:
B2_TOOLSET: ${{matrix.toolset}}
B2_CXXSTD: ${{matrix.cxxstd}}

View File

@@ -40,8 +40,8 @@ const char* env(const char* s)
# pragma warning(pop)
#endif
if(r)
return r;
return "";
return r; // LCOV_EXCL_LINE
return ""; // LCOV_EXCL_LINE
}
void check_locales(const std::vector<const char*>& names)
@@ -59,12 +59,18 @@ void check_locales(const std::vector<const char*>& names)
void test_main(int /*argc*/, char** /*argv*/)
{
std::cerr << "- char8_t: ";
std::cerr << "- Character support: ";
std::cerr << (sizeof(wchar_t) * 8) << "bit-wchar_t ";
#ifdef __cpp_char8_t
std::cerr << "yes\n";
#else
std::cerr << "no\n";
std::cerr << "char8_t ";
#endif
#ifdef BOOST_LOCALE_ENABLE_CHAR16_T
std::cerr << "char16_t ";
#endif
#ifdef BOOST_LOCALE_ENABLE_CHAR32_T
std::cerr << "char32_t ";
#endif
std::cerr << std::endl;
std::cerr << "- std::basic_string<char8_t>: ";
#ifdef __cpp_lib_char8_t
std::cerr << "yes\n";
@@ -90,6 +96,7 @@ void test_main(int /*argc*/, char** /*argv*/)
#else
std::cerr << "- Without iconv\n";
#endif
std::cerr << "- Environment \n";
std::cerr << " LANG=" << env("LANG") << std::endl;
std::cerr << " LC_ALL=" << env("LC_ALL") << std::endl;

View File

@@ -341,7 +341,7 @@ struct utfutf<wchar_t, 4> {
if(iConvUsesWTF8()) {
static char buf[16] = "\x67\x72\xF9\x80\x80\x80\x80"
"üßen";
return buf;
return buf; // LCOV_EXCL_LINE
} else {
return utfutf<char>::ok();
}
@@ -464,8 +464,8 @@ void test_utf_for()
if(iConvUsesWTF8() && utfutf<Char>::bad_decoded_to_utf8() != utfutf<char>::ok()) {
// Run just this one test, as there won't be an error reported so the "stop" tests will fail.
// Other backends might do it correctly but we can't pass multiple expected results here.
TEST_EQ(boost::locale::conv::from_utf<Char>(utfutf<Char>::bad(), "UTF-8"),
utfutf<Char>::bad_decoded_to_utf8());
TEST_EQ(boost::locale::conv::from_utf<Char>(utfutf<Char>::bad(), "UTF-8"), // LCOV_EXCL_LINE
utfutf<Char>::bad_decoded_to_utf8()); // LCOV_EXCL_LINE
} else
test_error_from_utf<Char>(utfutf<Char>::bad(), utfutf<Char>::bad_decoded_to_utf8(), "UTF-8");
std::cout << "-- Error for decoding to Latin1" << std::endl;
@@ -476,7 +476,7 @@ void test_utf_for()
std::string expected = utfutf<Char>::bad_char_decoded_to_utf8();
expected += expected; // 2 bad chars
if(iConvUsesWTF8() && utfutf<Char>::bad_decoded_to_utf8() != utfutf<char>::ok())
TEST_EQ(boost::locale::conv::from_utf<Char>(onlyInvalidUtf, "UTF-8"), expected);
TEST_EQ(boost::locale::conv::from_utf<Char>(onlyInvalidUtf, "UTF-8"), expected); // LCOV_EXCL_LINE
else
test_error_from_utf<Char>(onlyInvalidUtf, expected, "UTF-8");
std::cout << "-- Error decoding string of only invalid chars to Latin1" << std::endl;