[PATCH] D45715: [libcxx] [test] Remove nonportable that errc::is_a_directory produces "Is a directory" from ios_base::failure tests
Billy Robert O'Neal III via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 16 20:38:07 PDT 2018
BillyONeal created this revision.
BillyONeal added reviewers: mclow.lists, EricWF.
Remove nonportable assumption in io_error tests that std::errc::is_a_directory has message "Is a directory". On MSVC++ it reports "is a directory" (with a lowercase I).
https://reviews.llvm.org/D45715
Files:
test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp
test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp
Index: test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp
===================================================================
--- test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp
+++ test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp
@@ -28,7 +28,8 @@
assert(se.code() == std::make_error_code(std::errc::is_a_directory));
std::string what_message(se.what());
assert(what_message.find(what_arg) != std::string::npos);
- assert(what_message.find("Is a directory") != std::string::npos);
+ assert(what_message.find(std::generic_category().message(static_cast<int>
+ (std::errc::is_a_directory))) != std::string::npos);
}
{
std::string what_arg("io test message");
Index: test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp
===================================================================
--- test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp
+++ test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp
@@ -15,6 +15,7 @@
#include <ios>
#include <string>
+#include <system_error>
#include <cassert>
int main()
@@ -25,7 +26,8 @@
assert(se.code() == std::make_error_code(std::errc::is_a_directory));
std::string what_message(se.what());
assert(what_message.find(what_arg) != std::string::npos);
- assert(what_message.find("Is a directory") != std::string::npos);
+ assert(what_message.find(std::generic_category().message(static_cast<int>
+ (std::errc::is_a_directory))) != std::string::npos);
}
{
std::string what_arg("io test message");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45715.142732.patch
Type: text/x-patch
Size: 1894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180417/82ce0396/attachment.bin>
More information about the cfe-commits
mailing list