Skip to content

Commit 223ffdd

Browse files
committed
tests: Don't require C++17
Don't include glibmm.h and don't call Glib::init(). Then no included header file requires C++17 support, just C++14 support. Glib::init() is not necessary, because libxml++ uses only a small part of glibmm, mainly Glib::ustring.
1 parent 1a2a37a commit 223ffdd

File tree

3 files changed

+9
-6
lines changed
  • tests
    • saxparser_chunk_parsing_inconsistent_state
    • saxparser_parse_double_free
    • saxparser_parse_stream_inconsistent_state

3 files changed

+9
-6
lines changed

tests/saxparser_chunk_parsing_inconsistent_state/main.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <libxml++/libxml++.h>
2020

2121
#include <cstdlib>
22-
#include <glibmm.h>
2322
#include <sstream>
2423
#include <stdexcept>
2524

@@ -38,7 +37,9 @@ class MySaxParser : public xmlpp::SaxParser
3837

3938
int main()
4039
{
41-
Glib::init();
40+
// Set the global C and C++ locale to the user-configured locale,
41+
// so we can use std::cout with UTF-8, via Glib::ustring, without exceptions.
42+
std::locale::global(std::locale(""));
4243

4344
{
4445
MySaxParser parser;

tests/saxparser_parse_double_free/main.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <libxml++/libxml++.h>
2020

2121
#include <cstdlib>
22-
#include <glibmm.h>
2322
#include <stdexcept>
2423

2524
class OnCdataBlockTestParser : public xmlpp::SaxParser
@@ -340,7 +339,9 @@ void test_on_start_element()
340339

341340
int main()
342341
{
343-
Glib::init();
342+
// Set the global C and C++ locale to the user-configured locale,
343+
// so we can use std::cout with UTF-8, via Glib::ustring, without exceptions.
344+
std::locale::global(std::locale(""));
344345

345346
test_on_cdata_block();
346347
test_on_characters();

tests/saxparser_parse_stream_inconsistent_state/main.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <libxml++/libxml++.h>
2020

2121
#include <cstdlib>
22-
#include <glibmm.h>
2322
#include <sstream>
2423
#include <stdexcept>
2524

@@ -34,7 +33,9 @@ class MySaxParser : public xmlpp::SaxParser
3433

3534
int main()
3635
{
37-
Glib::init();
36+
// Set the global C and C++ locale to the user-configured locale,
37+
// so we can use std::cout with UTF-8, via Glib::ustring, without exceptions.
38+
std::locale::global(std::locale(""));
3839

3940
{
4041
MySaxParser parser;

0 commit comments

Comments
 (0)