Skip to content

Commit a2cfda8

Browse files
committed
Fix portability issues for building tests in MinGW
1 parent 916dcf8 commit a2cfda8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

test/beast/core/file_test.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <boost/filesystem/path.hpp>
1717
#include <boost/filesystem/operations.hpp>
1818
#include <boost/filesystem/fstream.hpp>
19-
#include <fstream>
2019
#include <iterator>
2120
#include <string>
2221
#include <type_traits>
@@ -43,7 +42,7 @@ test_file()
4342
namespace fs = boost::filesystem;
4443

4544
static constexpr
46-
#ifdef _WIN32
45+
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
4746
boost::winapi::WCHAR_ unicode_suffix[] = { 0xd83e, 0xdd84, 0x0000 }; // UTF-16-LE unicorn
4847
#else
4948
char unicode_suffix[] = { '\xf0', '\x9f', '\xa6', '\x84', '\x00' }; // UTF-8 unicorn
@@ -112,8 +111,8 @@ test_file()
112111
[](fs::path const& path)
113112
{
114113
// no exceptions - failure will result in an empty string
115-
std::ifstream in;
116-
in.open(path.native());
114+
fs::ifstream in;
115+
in.open(path);
117116
noskipws(in);
118117
auto s = std::string(
119118
std::istream_iterator<char>(in),

test/beast/http/file_body.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class file_body_test : public beast::unit_test::suite
168168
"0123456789"; // 40
169169
// create the temporary file
170170
{
171-
std::ofstream fstemp(temp.path().native());
171+
std::ofstream fstemp(temp.path().string());
172172
std::size_t written = 0;
173173
std::size_t to_write = 4097;
174174
while (written < to_write)
@@ -223,7 +223,7 @@ class file_body_test : public beast::unit_test::suite
223223
"0123456789"; // 40
224224
// create the temporary file
225225
{
226-
std::ofstream fstemp(temp.path().native());
226+
std::ofstream fstemp(temp.path().string());
227227
std::size_t written = 0;
228228
std::size_t to_write = 2048;
229229
while (written < to_write)

0 commit comments

Comments
 (0)