mirror of
https://github.com/boostorg/filesystem.git
synced 2025-05-12 13:41:47 +00:00
Stop testing exception message contents.
The contents is (a) language dependent and (b) is modified by some standard libraries (e.g. libstdc++ and Dinkumware) and possibly OS, which causes test failures on AppVeyor.
This commit is contained in:
parent
3a323cae2d
commit
fc2da43e81
@ -32,16 +32,12 @@ using boost::system::error_code;
|
|||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
#ifdef BOOST_WINDOWS_API
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
namespace {
|
namespace {
|
||||||
typedef int errno_t;
|
typedef int errno_t;
|
||||||
std::string platform(BOOST_PLATFORM);
|
std::string platform(BOOST_PLATFORM);
|
||||||
bool report_throws = false;
|
bool report_throws = false;
|
||||||
bool cleanup = true;
|
bool cleanup = true;
|
||||||
bool skip_long_windows_tests = false;
|
bool skip_long_windows_tests = false;
|
||||||
unsigned short language_id; // 0 except for Windows
|
|
||||||
|
|
||||||
} // unnamed namespace
|
} // unnamed namespace
|
||||||
|
|
||||||
@ -78,11 +74,6 @@ int cpp_main(int argc, char* argv[])
|
|||||||
platform = "POSIX";
|
platform = "POSIX";
|
||||||
#elif defined(BOOST_WINDOWS_API)
|
#elif defined(BOOST_WINDOWS_API)
|
||||||
platform = "Windows";
|
platform = "Windows";
|
||||||
#if !defined(__MINGW32__) && !defined(__CYGWIN__)
|
|
||||||
language_id = ::GetUserDefaultUILanguage();
|
|
||||||
#else
|
|
||||||
language_id = 0x0409; // Assume US English
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#error neither BOOST_POSIX_API nor BOOST_WINDOWS_API is defined. See boost/system/api_config.hpp
|
#error neither BOOST_POSIX_API nor BOOST_WINDOWS_API is defined. See boost/system/api_config.hpp
|
||||||
#endif
|
#endif
|
||||||
@ -122,4 +113,4 @@ int cpp_main(int argc, char* argv[])
|
|||||||
|
|
||||||
cout << "returning from main()" << endl;
|
cout << "returning from main()" << endl;
|
||||||
return ::boost::report_errors();
|
return ::boost::report_errors();
|
||||||
} // main
|
}
|
||||||
|
@ -120,8 +120,6 @@ bool create_symlink_ok(true);
|
|||||||
|
|
||||||
fs::path ng(" no-way, Jose");
|
fs::path ng(" no-way, Jose");
|
||||||
|
|
||||||
unsigned short language_id; // 0 except for Windows
|
|
||||||
|
|
||||||
const fs::path temp_dir(fs::unique_path("op-test-%%%%-%%%%"));
|
const fs::path temp_dir(fs::unique_path("op-test-%%%%-%%%%"));
|
||||||
|
|
||||||
void create_file(const fs::path& ph, const std::string& contents = std::string())
|
void create_file(const fs::path& ph, const std::string& contents = std::string())
|
||||||
@ -317,12 +315,7 @@ void exception_tests()
|
|||||||
catch (std::runtime_error x)
|
catch (std::runtime_error x)
|
||||||
{
|
{
|
||||||
exception_thrown = true;
|
exception_thrown = true;
|
||||||
if (report_throws)
|
cout << " x.what() returns \"" << x.what() << "\"" << endl;
|
||||||
cout << x.what() << endl;
|
|
||||||
if (platform == "Windows" && language_id == 0x0409) // English (United States)
|
|
||||||
// the stdcxx standard library apparently appends additional info
|
|
||||||
// to what(), so check only the initial portion:
|
|
||||||
BOOST_TEST(std::strncmp(x.what(), "boost::filesystem::create_directory", sizeof("boost::filesystem::create_directory") - 1) == 0);
|
|
||||||
}
|
}
|
||||||
BOOST_TEST(exception_thrown);
|
BOOST_TEST(exception_thrown);
|
||||||
|
|
||||||
@ -337,10 +330,7 @@ void exception_tests()
|
|||||||
catch (system_error x)
|
catch (system_error x)
|
||||||
{
|
{
|
||||||
exception_thrown = true;
|
exception_thrown = true;
|
||||||
if (report_throws)
|
cout << " x.what() returns \"" << x.what() << "\"" << endl;
|
||||||
cout << x.what() << endl;
|
|
||||||
if (platform == "Windows" && language_id == 0x0409) // English (United States)
|
|
||||||
BOOST_TEST(std::strcmp(x.what(), "boost::filesystem::create_directory: The system cannot find the path specified") == 0);
|
|
||||||
}
|
}
|
||||||
BOOST_TEST(exception_thrown);
|
BOOST_TEST(exception_thrown);
|
||||||
|
|
||||||
@ -355,17 +345,7 @@ void exception_tests()
|
|||||||
catch (fs::filesystem_error x)
|
catch (fs::filesystem_error x)
|
||||||
{
|
{
|
||||||
exception_thrown = true;
|
exception_thrown = true;
|
||||||
if (report_throws)
|
cout << " x.what() returns \"" << x.what() << "\"" << endl;
|
||||||
cout << x.what() << endl;
|
|
||||||
if (platform == "Windows" && language_id == 0x0409) // English (United States)
|
|
||||||
{
|
|
||||||
bool ok(std::strcmp(x.what(), "boost::filesystem::create_directory: The system cannot find the path specified: \"no-such-dir/foo/bar\"") == 0);
|
|
||||||
BOOST_TEST(ok);
|
|
||||||
if (!ok)
|
|
||||||
{
|
|
||||||
cout << "what returns \"" << x.what() << "\"" << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
BOOST_TEST(exception_thrown);
|
BOOST_TEST(exception_thrown);
|
||||||
|
|
||||||
@ -380,17 +360,7 @@ void exception_tests()
|
|||||||
catch (const fs::filesystem_error& x)
|
catch (const fs::filesystem_error& x)
|
||||||
{
|
{
|
||||||
exception_thrown = true;
|
exception_thrown = true;
|
||||||
if (report_throws)
|
cout << " x.what() returns \"" << x.what() << "\"" << endl;
|
||||||
cout << x.what() << endl;
|
|
||||||
if (platform == "Windows" && language_id == 0x0409) // English (United States)
|
|
||||||
{
|
|
||||||
bool ok(std::strcmp(x.what(), "boost::filesystem::create_directory: The system cannot find the path specified: \"no-such-dir/foo/bar\"") == 0);
|
|
||||||
BOOST_TEST(ok);
|
|
||||||
if (!ok)
|
|
||||||
{
|
|
||||||
cout << "what returns \"" << x.what() << "\"" << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
BOOST_TEST(exception_thrown);
|
BOOST_TEST(exception_thrown);
|
||||||
|
|
||||||
@ -2518,7 +2488,6 @@ int cpp_main(int argc, char* argv[])
|
|||||||
platform = "POSIX";
|
platform = "POSIX";
|
||||||
#elif defined(BOOST_WINDOWS_API)
|
#elif defined(BOOST_WINDOWS_API)
|
||||||
platform = "Windows";
|
platform = "Windows";
|
||||||
language_id = ::GetUserDefaultUILanguage();
|
|
||||||
#else
|
#else
|
||||||
#error neither BOOST_POSIX_API nor BOOST_WINDOWS_API is defined. See boost/system/api_config.hpp
|
#error neither BOOST_POSIX_API nor BOOST_WINDOWS_API is defined. See boost/system/api_config.hpp
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user