sapling/eden/fs/utils/test/BugTest.cpp
Adam Simpkins c8c1ba5eab remove eden/fs/utils/test/TestChecks.h
Summary:
The gtest macros in this file were moved to folly/test/TestUtils.h
Update everything to just use folly/test/TestUtils.h directly.

Reviewed By: chadaustin

Differential Revision: D6301759

fbshipit-source-id: 7f2841c12d5bea15376f782fb3bf3bfef16039c7
2017-11-15 12:53:55 -08:00

36 lines
942 B
C++

/*
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#include "eden/fs/utils/Bug.h"
#include <folly/ExceptionWrapper.h>
#include <folly/test/TestUtils.h>
#include <gtest/gtest.h>
using namespace facebook::eden;
namespace {
void buggyFunction() {
EDEN_BUG() << "oh noes";
}
} // namespace
TEST(EdenBug, throws) {
EdenBugDisabler noCrash;
EXPECT_THROW_RE(buggyFunction(), std::runtime_error, "oh noes");
EXPECT_THROW_RE(EDEN_BUG() << "doh", std::runtime_error, "doh");
}
TEST(EdenBug, toException) {
EdenBugDisabler noCrash;
auto bug = EDEN_BUG() << "whoops";
auto ew = bug.toException();
EXPECT_THROW_RE(ew.throw_exception(), std::runtime_error, "whoops");
}