Skip tests that expect exceptions be thrown.
Differential Revision: https://reviews.llvm.org/D27096
llvm-svn: 288156
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <locale>
// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
static_assert(!std::is_convertible<std::string, Myconv>::value, "");
static_assert( std::is_constructible<Myconv, std::string>::value, "");
#endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
Myconv myconv;
try
{
}
}
+#endif
{
Myconv myconv("byte error");
std::string bs = myconv.to_bytes(L"\xDA83");
assert(bs == "byte error");
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
myconv.from_bytes('\xA5');
catch (const std::range_error&)
{
}
+#endif
}
{
Myconv myconv("byte error", L"wide error");
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <locale>
// template <class Facet> const Facet& use_facet(const locale& loc);
#include <locale>
#include <cassert>
+#include "test_macros.h"
+
int facet_count = 0;
struct my_facet
int main()
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
const my_facet& f = std::use_facet<my_facet>(std::locale());
catch (std::bad_cast&)
{
}
+#endif
const my_facet* fp = 0;
{
std::locale loc(std::locale(), new my_facet);
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
#include "count_new.hpp"
#include "platform_support.h" // locale name macros
+#include "test_macros.h"
+
void check(const std::locale& loc)
{
check(loc3);
assert(!(loc == loc3));
assert(loc != loc3);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::locale((const char*)0);
catch (std::runtime_error&)
{
}
+#endif
std::locale ok("");
}
assert(globalMemCounter.checkOutstandingNewEq(0));
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <locale>
// template <class Facet> locale combine(const locale& other) const;
#include "count_new.hpp"
+#include "test_macros.h"
+
void check(const std::locale& loc)
{
assert(std::has_facet<std::collate<char> >(loc));
}
assert(globalMemCounter.checkOutstandingNewEq(0));
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
{
std::locale loc;
}
assert(globalMemCounter.checkOutstandingNewEq(0));
}
+#endif
}