• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devmarkusb / util / 23399309665

22 Mar 2026 08:36AM UTC coverage: 88.255% (-0.002%) from 88.257%
23399309665

push

github

MarkusB
Refactor `new_statistics` to remove `UL_I_AM_SURE_TO_REPLACE_NEW_DELETE` macro and improve `str_convert` structure implementation.

15 of 15 new or added lines in 2 files covered. (100.0%)

5 existing lines in 3 files now uncovered.

5816 of 6590 relevant lines covered (88.25%)

347.08 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.0
/string/src/locale.test.cpp
1
#include "ul/string/locale.h"
2
#include "gtest/gtest.h"
3
#include <iostream>
4
#include <locale>
5
#include <sstream>
6
#include <string>
7

8
namespace ul = mb::ul;
9

10
TEST(consoleTest, set_global_localeTest_localenc) {
4✔
UNCOV
11
    const std::string s = "\xe4"
×
12
                          "hnlich"; // latin1 encoding
1✔
13
    std::stringstream ss;
1✔
14
    std::cout << s << "\n";
1✔
15
    ss << s;
1✔
16
    const std::string res1(ss.str());
1✔
17
    std::cout << res1 << "\n";
1✔
18

19
// #locale_facet-exception
20
// For mingw 50300 the following exception is thrown:
21
// C++ exception with description "locale::facet::_S_create_c_locale name not valid" thrown in the test body.
22
// Strange stuff: Happens only during unit test as part of compilation. Not failing when
23
// starting the test exe separately - so no debugging possible :/
24
// Also the build server doesn't fail!
25
#if !(UL_COMP_MINGW && UL_COMP_MINGW_VER <= 50300)
26
    const ul::SetGlobalLocaleScoped loc{ul::GlobalLocale::user_preferred};
1✔
27
    const std::locale first = loc.get_original_locale();
1✔
28
    EXPECT_EQ(std::locale::classic(), first);
1✔
29
    /*std::locale userpref = */ ul::set_global_locale(ul::GlobalLocale::default_classic);
1✔
30
    const std::locale classictest = ul::set_global_locale(ul::GlobalLocale::user_preferred);
2✔
31
    EXPECT_EQ(std::locale::classic(), classictest);
1✔
32
#endif
33

34
    std::stringstream ss2;
2✔
35
    std::cout << s << "\n";
1✔
36
    ss2 << s;
1✔
37
    const std::string res2(ss2.str());
2✔
38
    std::cout << res2 << "\n";
1✔
39

40
    // even ul::set_global_locale_scoped loc{"German_Germany.UTF-8"}; // doesn't work for
41
    // const std::string s = "\xc3\xa4"hnlich";
42
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc