Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com>2019-12-12 21:55:26 +0300
committerJordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com>2019-12-12 21:55:26 +0300
commit4f6f05d463780b94811d974426c1aef95b3db39b (patch)
tree7afff9111fdc0e061b28eb9484b8e5606a5d4f68 /tests/string_span_tests.cpp
parentec05ecd6b145d1bf2473689408279c2e2685c94f (diff)
changing text in notices & readme. adding terminate handler for tests
Diffstat (limited to 'tests/string_span_tests.cpp')
-rw-r--r--tests/string_span_tests.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/tests/string_span_tests.cpp b/tests/string_span_tests.cpp
index 9fd2d1b..64f7ea0 100644
--- a/tests/string_span_tests.cpp
+++ b/tests/string_span_tests.cpp
@@ -72,6 +72,7 @@ auto strnlen(const CharT* s, std::size_t n)
namespace
{
+constexpr std::string_view deathstring("Expected Death");
template <typename T>
T move_wrapper(T&& t)
@@ -964,6 +965,10 @@ TEST(string_span_tests, Conversion)
TEST(string_span_tests, zstring)
{
+ std::set_terminate([] {
+ std::cerr << "Expected Death. zstring";
+ std::abort();
+ });
// create zspan from zero terminated string
{
@@ -983,7 +988,7 @@ TEST(string_span_tests, zstring)
buf[0] = 'a';
auto workaround_macro = [&]() { const zstring_span<> zspan({buf, 1}); };
- EXPECT_DEATH(workaround_macro(), ".*");
+ EXPECT_DEATH(workaround_macro(), deathstring.data());
}
// usage scenario: create zero-terminated temp file name and pass to a legacy API
@@ -1001,7 +1006,11 @@ TEST(string_span_tests, zstring)
TEST(string_span_tests, wzstring)
{
-
+ std::set_terminate([] {
+ std::cerr << "Expected Death. wzstring";
+ std::abort();
+ });
+
// create zspan from zero terminated string
{
wchar_t buf[1];
@@ -1020,7 +1029,7 @@ TEST(string_span_tests, wzstring)
buf[0] = L'a';
const auto workaround_macro = [&]() { const wzstring_span<> zspan({buf, 1}); };
- EXPECT_DEATH(workaround_macro(), ".*");
+ EXPECT_DEATH(workaround_macro(), deathstring.data());
}
// usage scenario: create zero-terminated temp file name and pass to a legacy API
@@ -1037,7 +1046,11 @@ TEST(string_span_tests, wzstring)
}
TEST(string_span_tests, u16zstring)
-{
+{
+ std::set_terminate([] {
+ std::cerr << "Expected Death. u16zstring";
+ std::abort();
+ });
// create zspan from zero terminated string
{
@@ -1057,7 +1070,7 @@ TEST(string_span_tests, u16zstring)
buf[0] = u'a';
const auto workaround_macro = [&]() { const u16zstring_span<> zspan({buf, 1}); };
- EXPECT_DEATH(workaround_macro(), ".*");
+ EXPECT_DEATH(workaround_macro(), deathstring.data());
}
// usage scenario: create zero-terminated temp file name and pass to a legacy API
@@ -1075,6 +1088,10 @@ TEST(string_span_tests, u16zstring)
TEST(string_span_tests, u32zstring)
{
+ std::set_terminate([] {
+ std::cerr << "Expected Death. u31zstring";
+ std::abort();
+ });
// create zspan from zero terminated string
{
@@ -1094,7 +1111,7 @@ TEST(string_span_tests, u32zstring)
buf[0] = u'a';
const auto workaround_macro = [&]() { const u32zstring_span<> zspan({buf, 1}); };
- EXPECT_DEATH(workaround_macro(), ".*");
+ EXPECT_DEATH(workaround_macro(), deathstring.data());
}
// usage scenario: create zero-terminated temp file name and pass to a legacy API