change from string to char*

This commit is contained in:
Jordan Maples [MSFT] 2019-12-12 16:48:59 -08:00
parent 0931262acf
commit 6c5c708877
10 changed files with 18 additions and 21 deletions

View File

@ -38,7 +38,7 @@
#include <cstddef> // for size_t #include <cstddef> // for size_t
namespace{ namespace{
static const std::string deathstring("Expected Death"); static const char *deathstring("Expected Death");
} }
namespace gsl namespace gsl

View File

@ -51,7 +51,7 @@ int g(int i)
return i; return i;
} }
static const std::string deathstring("Expected Death"); static const char *deathstring("Expected Death");
} // namespace } // namespace
TEST(assertion_tests, expects) TEST(assertion_tests, expects)

View File

@ -41,7 +41,7 @@
#include <vector> // for vector #include <vector> // for vector
namespace{ namespace{
static const std::string deathstring("Expected Death"); static const char *deathstring("Expected Death");
} }
TEST(at_tests, static_array) 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(a, i) == i + 1);
EXPECT_TRUE(gsl::at({1, 2, 3, 4}, i) == i + 1); EXPECT_TRUE(gsl::at({1, 2, 3, 4}, i) == i + 1);
} }
std::set_terminate([] { std::set_terminate([] {
std::cerr << "Expected Death. InitializerList"; std::cerr << "Expected Death. InitializerList";
std::abort(); std::abort();

View File

@ -139,7 +139,7 @@ void fn(const Bounds&)
static_assert(Bounds::static_size == 60, "static bounds is wrong size"); 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 } // namespace
TEST(multi_span_test, default_constructor) 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::cerr << "Expected Death. from_pointer_pointer_constructor";
std::abort(); std::abort();
}); });
{ {
auto workaround_macro = [&]() { const multi_span<int> s{&arr[1], &arr[0]}; }; auto workaround_macro = [&]() { const multi_span<int> s{&arr[1], &arr[0]}; };
EXPECT_DEATH(workaround_macro(), deathstring); EXPECT_DEATH(workaround_macro(), deathstring);
@ -1108,7 +1108,7 @@ TEST(multi_span_test, extent)
std::cerr << "Expected Death. extent"; std::cerr << "Expected Death. extent";
std::abort(); std::abort();
}); });
{ {
multi_span<int> s; multi_span<int> s;
EXPECT_TRUE(s.extent() == 0); EXPECT_TRUE(s.extent() == 0);

View File

@ -53,7 +53,7 @@ struct fail_fast;
using namespace gsl; using namespace gsl;
namespace{ namespace{
static const std::string deathstring("Expected Death"); static const char *deathstring("Expected Death");
} }
struct MyBase struct MyBase
@ -458,7 +458,7 @@ TEST(notnull_tests, TestNotNullConstructorTypeDeduction)
EXPECT_TRUE(*x == 42); EXPECT_TRUE(*x == 42);
} }
std::set_terminate([] { std::set_terminate([] {
std::cerr << "Expected Death. TestNotNullConstructorTypeDeduction"; std::cerr << "Expected Death. TestNotNullConstructorTypeDeduction";
std::abort(); std::abort();

View File

@ -75,7 +75,7 @@ struct AddressOverloaded
return {}; return {};
} }
}; };
static const std::string deathstring("Expected Death"); static const char *deathstring("Expected Death");
} // namespace } // namespace
TEST(span_test, constructors) TEST(span_test, constructors)

View File

@ -42,10 +42,6 @@ namespace gsl
struct fail_fast; struct fail_fast;
} // namespace gsl } // namespace gsl
namespace{
static const std::string deathstring("Expected Death");
}
using namespace gsl; using namespace gsl;
GSL_SUPPRESS(f.4) // NO-FORMAT: attribute GSL_SUPPRESS(f.4) // NO-FORMAT: attribute
@ -147,6 +143,7 @@ TEST(strict_notnull_tests, TestStrictNotNull)
} }
#if defined(__cplusplus) && (__cplusplus >= 201703L) #if defined(__cplusplus) && (__cplusplus >= 201703L)
static const char *deathstring("Expected Death");
TEST(strict_notnull_tests, TestStrictNotNullConstructorTypeDeduction) TEST(strict_notnull_tests, TestStrictNotNullConstructorTypeDeduction)
{ {

View File

@ -56,7 +56,7 @@ using namespace gsl;
namespace namespace
{ {
static const std::string deathstring("Expected Death"); static const char *deathstring("Expected Death");
struct BaseClass struct BaseClass
{ {
}; };
@ -420,7 +420,7 @@ TEST(strided_span_tests, strided_span_bounds)
{ {
int arr[] = {0, 1, 2, 3}; int arr[] = {0, 1, 2, 3};
multi_span<int> av(arr); multi_span<int> av(arr);
std::set_terminate([] { std::set_terminate([] {
std::cerr << "Expected Death. strided_span_bounds"; std::cerr << "Expected Death. strided_span_bounds";
std::abort(); std::abort();
@ -541,7 +541,7 @@ TEST(strided_span_tests, strided_span_type_conversion)
{ {
int arr[] = {0, 1, 2, 3}; int arr[] = {0, 1, 2, 3};
multi_span<int> av(arr); multi_span<int> av(arr);
std::set_terminate([] { std::set_terminate([] {
std::cerr << "Expected Death. strided_span_type_conversion"; std::cerr << "Expected Death. strided_span_type_conversion";
std::abort(); std::abort();

View File

@ -72,7 +72,7 @@ auto strnlen(const CharT* s, std::size_t n)
namespace namespace
{ {
static const std::string deathstring("Expected Death"); static const char *deathstring("Expected Death");
template <typename T> template <typename T>
T move_wrapper(T&& t) T move_wrapper(T&& t)
@ -1046,7 +1046,7 @@ TEST(string_span_tests, wzstring)
} }
TEST(string_span_tests, u16zstring) TEST(string_span_tests, u16zstring)
{ {
std::set_terminate([] { std::set_terminate([] {
std::cerr << "Expected Death. u16zstring"; std::cerr << "Expected Death. u16zstring";
std::abort(); std::abort();

View File

@ -45,7 +45,7 @@
using namespace gsl; using namespace gsl;
namespace{ namespace{
static const std::string deathstring("Expected Death"); static const char *deathstring("Expected Death");
void f(int& i) { i += 1; } void f(int& i) { i += 1; }
static int j = 0; static int j = 0;
void g() { j += 1; } void g() { j += 1; }
@ -119,7 +119,7 @@ TEST(utils_tests, narrow_cast)
} }
TEST(utils_tests, narrow) TEST(utils_tests, narrow)
{ {
std::set_terminate([] { std::set_terminate([] {
std::cerr << "Expected Death. narrow"; std::cerr << "Expected Death. narrow";
std::abort(); std::abort();