Skip to content

Commit

Permalink
Protect tests that expect an exception for an unknown std::random_device
Browse files Browse the repository at this point in the history
Skip these tests under libcpp-no-exceptions.

Differential Revision: https://reviews.llvm.org/D26141

llvm-svn: 285677
  • Loading branch information
Roger Ferrer Ibanez committed Nov 1, 2016
1 parent af20d5e commit 8cba0be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp
Expand Up @@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//

// XFAIL: libcpp-no-exceptions
// <random>

// class random_device;
Expand Down Expand Up @@ -44,11 +43,13 @@ void check_random_device_valid(const std::string &token) {
}

void check_random_device_invalid(const std::string &token) {
#ifndef TEST_HAS_NO_EXCEPTIONS
try {
std::random_device r(token);
LIBCPP_ASSERT(false);
} catch (const std::system_error&) {
}
#endif
}


Expand Down
3 changes: 2 additions & 1 deletion libcxx/test/std/numerics/rand/rand.device/eval.pass.cpp
Expand Up @@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//

// XFAIL: libcpp-no-exceptions
// <random>

// class random_device;
Expand All @@ -26,6 +25,7 @@ int main()
std::random_device::result_type e = r();
}

#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::random_device r("/dev/null");
Expand All @@ -35,4 +35,5 @@ int main()
catch (const std::system_error&)
{
}
#endif
}

0 comments on commit 8cba0be

Please sign in to comment.