Update errcat.objects tests so they test the bug fixed in r272640.

llvm-svn: 272642
This commit is contained in:
Eric Fiselier 2016-06-14 06:37:36 +00:00
parent 61df7909ab
commit db72c625e2
2 changed files with 11 additions and 6 deletions

View File

@ -18,10 +18,13 @@
#include <string>
#include <cerrno>
void test_message_leaves_errno_unchanged() {
#include "test_macros.h"
void test_message_for_bad_value() {
errno = E2BIG; // something that message will never generate
const std::error_category& e_cat1 = std::generic_category();
e_cat1.message(-1);
const std::string msg = e_cat1.message(-1);
LIBCPP_ASSERT(msg == "Unknown error -1");
assert(errno == E2BIG);
}
@ -31,6 +34,6 @@ int main()
std::string m1 = e_cat1.name();
assert(m1 == "generic");
{
test_message_leaves_errno_unchanged();
test_message_for_bad_value();
}
}

View File

@ -18,11 +18,13 @@
#include <string>
#include <cerrno>
#include "test_macros.h"
void test_message_leaves_errno_unchanged() {
void test_message_for_bad_value() {
errno = E2BIG; // something that message will never generate
const std::error_category& e_cat1 = std::system_category();
e_cat1.message(-1);
const std::string msg = e_cat1.message(-1);
LIBCPP_ASSERT(msg == "Unknown error -1");
assert(errno == E2BIG);
}
@ -36,6 +38,6 @@ int main()
assert(e_cond.value() == 5000);
assert(e_cond.category() == std::system_category());
{
test_message_leaves_errno_unchanged();
test_message_for_bad_value();
}
}