diff --git a/tests/algorithm_tests.cpp b/tests/algorithm_tests.cpp index 0866654..e42a99d 100644 --- a/tests/algorithm_tests.cpp +++ b/tests/algorithm_tests.cpp @@ -38,7 +38,7 @@ #include // for size_t namespace{ -static const std::string deathstring("Expected Death"); +static const char *deathstring("Expected Death"); } namespace gsl diff --git a/tests/assertion_tests.cpp b/tests/assertion_tests.cpp index db56007..0e4dd34 100644 --- a/tests/assertion_tests.cpp +++ b/tests/assertion_tests.cpp @@ -51,7 +51,7 @@ int g(int i) return i; } -static const std::string deathstring("Expected Death"); +static const char *deathstring("Expected Death"); } // namespace TEST(assertion_tests, expects) diff --git a/tests/at_tests.cpp b/tests/at_tests.cpp index 29359e9..98f261a 100644 --- a/tests/at_tests.cpp +++ b/tests/at_tests.cpp @@ -41,7 +41,7 @@ #include // for vector namespace{ -static const std::string deathstring("Expected Death"); +static const char *deathstring("Expected Death"); } TEST(at_tests, static_array) @@ -115,7 +115,7 @@ TEST(at_tests, InitializerList) EXPECT_TRUE(gsl::at(a, i) == i + 1); EXPECT_TRUE(gsl::at({1, 2, 3, 4}, i) == i + 1); } - + std::set_terminate([] { std::cerr << "Expected Death. InitializerList"; std::abort(); diff --git a/tests/multi_span_tests.cpp b/tests/multi_span_tests.cpp index 490ce83..a4fdc56 100644 --- a/tests/multi_span_tests.cpp +++ b/tests/multi_span_tests.cpp @@ -139,7 +139,7 @@ void fn(const Bounds&) static_assert(Bounds::static_size == 60, "static bounds is wrong size"); } -static const std::string deathstring("Expected Death"); +static const char *deathstring("Expected Death"); } // namespace TEST(multi_span_test, default_constructor) @@ -426,7 +426,7 @@ TEST(multi_span_test, from_pointer_pointer_constructor) std::cerr << "Expected Death. from_pointer_pointer_constructor"; std::abort(); }); - + { auto workaround_macro = [&]() { const multi_span s{&arr[1], &arr[0]}; }; EXPECT_DEATH(workaround_macro(), deathstring); @@ -1108,7 +1108,7 @@ TEST(multi_span_test, extent) std::cerr << "Expected Death. extent"; std::abort(); }); - + { multi_span s; EXPECT_TRUE(s.extent() == 0); diff --git a/tests/notnull_tests.cpp b/tests/notnull_tests.cpp index 1649ed6..b1ac4d4 100644 --- a/tests/notnull_tests.cpp +++ b/tests/notnull_tests.cpp @@ -53,7 +53,7 @@ struct fail_fast; using namespace gsl; namespace{ -static const std::string deathstring("Expected Death"); +static const char *deathstring("Expected Death"); } struct MyBase @@ -458,7 +458,7 @@ TEST(notnull_tests, TestNotNullConstructorTypeDeduction) EXPECT_TRUE(*x == 42); } - + std::set_terminate([] { std::cerr << "Expected Death. TestNotNullConstructorTypeDeduction"; std::abort(); diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index c60383a..9336812 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -75,7 +75,7 @@ struct AddressOverloaded return {}; } }; -static const std::string deathstring("Expected Death"); +static const char *deathstring("Expected Death"); } // namespace TEST(span_test, constructors) diff --git a/tests/strict_notnull_tests.cpp b/tests/strict_notnull_tests.cpp index 60a94fa..766654b 100644 --- a/tests/strict_notnull_tests.cpp +++ b/tests/strict_notnull_tests.cpp @@ -42,10 +42,6 @@ namespace gsl struct fail_fast; } // namespace gsl -namespace{ -static const std::string deathstring("Expected Death"); -} - using namespace gsl; GSL_SUPPRESS(f.4) // NO-FORMAT: attribute @@ -147,6 +143,7 @@ TEST(strict_notnull_tests, TestStrictNotNull) } #if defined(__cplusplus) && (__cplusplus >= 201703L) +static const char *deathstring("Expected Death"); TEST(strict_notnull_tests, TestStrictNotNullConstructorTypeDeduction) { diff --git a/tests/strided_span_tests.cpp b/tests/strided_span_tests.cpp index a1abd73..f87f1dc 100644 --- a/tests/strided_span_tests.cpp +++ b/tests/strided_span_tests.cpp @@ -56,7 +56,7 @@ using namespace gsl; namespace { -static const std::string deathstring("Expected Death"); +static const char *deathstring("Expected Death"); struct BaseClass { }; @@ -420,7 +420,7 @@ TEST(strided_span_tests, strided_span_bounds) { int arr[] = {0, 1, 2, 3}; multi_span av(arr); - + std::set_terminate([] { std::cerr << "Expected Death. strided_span_bounds"; std::abort(); @@ -541,7 +541,7 @@ TEST(strided_span_tests, strided_span_type_conversion) { int arr[] = {0, 1, 2, 3}; multi_span av(arr); - + std::set_terminate([] { std::cerr << "Expected Death. strided_span_type_conversion"; std::abort(); diff --git a/tests/string_span_tests.cpp b/tests/string_span_tests.cpp index 386834c..16bcf07 100644 --- a/tests/string_span_tests.cpp +++ b/tests/string_span_tests.cpp @@ -72,7 +72,7 @@ auto strnlen(const CharT* s, std::size_t n) namespace { -static const std::string deathstring("Expected Death"); +static const char *deathstring("Expected Death"); template T move_wrapper(T&& t) @@ -1046,7 +1046,7 @@ TEST(string_span_tests, wzstring) } TEST(string_span_tests, u16zstring) -{ +{ std::set_terminate([] { std::cerr << "Expected Death. u16zstring"; std::abort(); diff --git a/tests/utils_tests.cpp b/tests/utils_tests.cpp index 6e6dd8a..5911371 100644 --- a/tests/utils_tests.cpp +++ b/tests/utils_tests.cpp @@ -45,7 +45,7 @@ using namespace gsl; namespace{ -static const std::string deathstring("Expected Death"); +static const char *deathstring("Expected Death"); void f(int& i) { i += 1; } static int j = 0; void g() { j += 1; } @@ -119,7 +119,7 @@ TEST(utils_tests, narrow_cast) } TEST(utils_tests, narrow) -{ +{ std::set_terminate([] { std::cerr << "Expected Death. narrow"; std::abort();