gsl::at behavior change regarding gsl::span (#985)

* move span specialization of 'at' to <gsl/span> and update the parameter to be taken by reference

* undid previous changes and acted upon decisions made in maintainer sync. Fixed tests failing in /kernel mode

* ran clang-format on the include folder

* ran clang-format on the test folder

Co-authored-by: Jordan Maples <jordan.maples@microsoft.com>
This commit is contained in:
Jordan Maples [MSFT]
2021-05-20 18:18:08 -07:00
committed by GitHub
co-authored by Jordan Maples
parent c1cbb41b42
commit b26f6d5ec7
20 changed files with 1304 additions and 1175 deletions
+6 -7
View File
@@ -14,14 +14,14 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <gtest/gtest.h>
#include "deathTestCommon.h"
#include <gsl/assert> // for fail_fast (ptr only), Ensures, Expects
#include <gtest/gtest.h>
using namespace gsl;
namespace
{
static constexpr char deathstring[] = "Expected Death";
int f(int i)
{
@@ -39,23 +39,22 @@ int g(int i)
TEST(assertion_tests, expects)
{
std::set_terminate([] {
const auto terminateHandler = std::set_terminate([] {
std::cerr << "Expected Death. expects";
std::abort();
});
EXPECT_TRUE(f(2) == 2);
EXPECT_DEATH(f(10), deathstring);
EXPECT_DEATH(f(10), GetExpectedDeathString(terminateHandler));
}
TEST(assertion_tests, ensures)
{
std::set_terminate([] {
const auto terminateHandler = std::set_terminate([] {
std::cerr << "Expected Death. ensures";
std::abort();
});
EXPECT_TRUE(g(2) == 3);
EXPECT_DEATH(g(9), deathstring);
EXPECT_DEATH(g(9), GetExpectedDeathString(terminateHandler));
}