Update errcat.objects tests so they test the bug fixed in r272640.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272642 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -18,10 +18,13 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cerrno>
|
#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
|
errno = E2BIG; // something that message will never generate
|
||||||
const std::error_category& e_cat1 = std::generic_category();
|
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);
|
assert(errno == E2BIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,6 +34,6 @@ int main()
|
|||||||
std::string m1 = e_cat1.name();
|
std::string m1 = e_cat1.name();
|
||||||
assert(m1 == "generic");
|
assert(m1 == "generic");
|
||||||
{
|
{
|
||||||
test_message_leaves_errno_unchanged();
|
test_message_for_bad_value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,13 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cerrno>
|
#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
|
errno = E2BIG; // something that message will never generate
|
||||||
const std::error_category& e_cat1 = std::system_category();
|
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);
|
assert(errno == E2BIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,6 +38,6 @@ int main()
|
|||||||
assert(e_cond.value() == 5000);
|
assert(e_cond.value() == 5000);
|
||||||
assert(e_cond.category() == std::system_category());
|
assert(e_cond.category() == std::system_category());
|
||||||
{
|
{
|
||||||
test_message_leaves_errno_unchanged();
|
test_message_for_bad_value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user