Protect locale tests under noexceptions
Skip tests that expect exceptions be thrown. Differential Revision: https://reviews.llvm.org/D27096 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288156 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -7,7 +7,6 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// XFAIL: libcpp-no-exceptions
|
|
||||||
// <locale>
|
// <locale>
|
||||||
|
|
||||||
// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
|
// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
|
||||||
@@ -29,6 +28,7 @@ int main()
|
|||||||
static_assert(!std::is_convertible<std::string, Myconv>::value, "");
|
static_assert(!std::is_convertible<std::string, Myconv>::value, "");
|
||||||
static_assert( std::is_constructible<Myconv, std::string>::value, "");
|
static_assert( std::is_constructible<Myconv, std::string>::value, "");
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||||
{
|
{
|
||||||
Myconv myconv;
|
Myconv myconv;
|
||||||
try
|
try
|
||||||
@@ -48,10 +48,12 @@ int main()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
Myconv myconv("byte error");
|
Myconv myconv("byte error");
|
||||||
std::string bs = myconv.to_bytes(L"\xDA83");
|
std::string bs = myconv.to_bytes(L"\xDA83");
|
||||||
assert(bs == "byte error");
|
assert(bs == "byte error");
|
||||||
|
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
myconv.from_bytes('\xA5');
|
myconv.from_bytes('\xA5');
|
||||||
@@ -60,6 +62,7 @@ int main()
|
|||||||
catch (const std::range_error&)
|
catch (const std::range_error&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Myconv myconv("byte error", L"wide error");
|
Myconv myconv("byte error", L"wide error");
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// XFAIL: libcpp-no-exceptions
|
|
||||||
// <locale>
|
// <locale>
|
||||||
|
|
||||||
// template <class Facet> const Facet& use_facet(const locale& loc);
|
// template <class Facet> const Facet& use_facet(const locale& loc);
|
||||||
@@ -15,6 +14,8 @@
|
|||||||
#include <locale>
|
#include <locale>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
int facet_count = 0;
|
int facet_count = 0;
|
||||||
|
|
||||||
struct my_facet
|
struct my_facet
|
||||||
@@ -32,6 +33,7 @@ std::locale::id my_facet::id;
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const my_facet& f = std::use_facet<my_facet>(std::locale());
|
const my_facet& f = std::use_facet<my_facet>(std::locale());
|
||||||
@@ -41,6 +43,7 @@ int main()
|
|||||||
catch (std::bad_cast&)
|
catch (std::bad_cast&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
const my_facet* fp = 0;
|
const my_facet* fp = 0;
|
||||||
{
|
{
|
||||||
std::locale loc(std::locale(), new my_facet);
|
std::locale loc(std::locale(), new my_facet);
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// XFAIL: libcpp-no-exceptions
|
|
||||||
// REQUIRES: locale.ru_RU.UTF-8
|
// REQUIRES: locale.ru_RU.UTF-8
|
||||||
// REQUIRES: locale.zh_CN.UTF-8
|
// REQUIRES: locale.zh_CN.UTF-8
|
||||||
|
|
||||||
@@ -22,6 +21,8 @@
|
|||||||
#include "count_new.hpp"
|
#include "count_new.hpp"
|
||||||
#include "platform_support.h" // locale name macros
|
#include "platform_support.h" // locale name macros
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
|
|
||||||
void check(const std::locale& loc)
|
void check(const std::locale& loc)
|
||||||
{
|
{
|
||||||
@@ -70,6 +71,7 @@ int main()
|
|||||||
check(loc3);
|
check(loc3);
|
||||||
assert(!(loc == loc3));
|
assert(!(loc == loc3));
|
||||||
assert(loc != loc3);
|
assert(loc != loc3);
|
||||||
|
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
std::locale((const char*)0);
|
std::locale((const char*)0);
|
||||||
@@ -86,6 +88,7 @@ int main()
|
|||||||
catch (std::runtime_error&)
|
catch (std::runtime_error&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
std::locale ok("");
|
std::locale ok("");
|
||||||
}
|
}
|
||||||
assert(globalMemCounter.checkOutstandingNewEq(0));
|
assert(globalMemCounter.checkOutstandingNewEq(0));
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// XFAIL: libcpp-no-exceptions
|
|
||||||
// <locale>
|
// <locale>
|
||||||
|
|
||||||
// template <class Facet> locale combine(const locale& other) const;
|
// template <class Facet> locale combine(const locale& other) const;
|
||||||
@@ -18,6 +17,8 @@
|
|||||||
|
|
||||||
#include "count_new.hpp"
|
#include "count_new.hpp"
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
void check(const std::locale& loc)
|
void check(const std::locale& loc)
|
||||||
{
|
{
|
||||||
assert(std::has_facet<std::collate<char> >(loc));
|
assert(std::has_facet<std::collate<char> >(loc));
|
||||||
@@ -78,6 +79,7 @@ int main()
|
|||||||
}
|
}
|
||||||
assert(globalMemCounter.checkOutstandingNewEq(0));
|
assert(globalMemCounter.checkOutstandingNewEq(0));
|
||||||
}
|
}
|
||||||
|
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::locale loc;
|
std::locale loc;
|
||||||
@@ -93,4 +95,5 @@ int main()
|
|||||||
}
|
}
|
||||||
assert(globalMemCounter.checkOutstandingNewEq(0));
|
assert(globalMemCounter.checkOutstandingNewEq(0));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user