memgraph/tests/unit/exceptions.cpp
Teon Banek 893df584f6 Merge utils/exceptions into single file
Summary: Update documentation of `utils/exceptions.hpp`

Reviewers: mislav.bradac, florijan, buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D300
2017-04-20 16:53:21 +02:00

28 lines
670 B
C++

#include "gtest/gtest.h"
#include "utils/exceptions.hpp"
void i_will_throw() { throw utils::BasicException("this is not ok"); }
void bar() { i_will_throw(); }
void foo() { bar(); }
void i_will_throw_stacktrace_exception() {
throw utils::StacktraceException("this is not {}", "ok!");
}
void bar_stacktrace() { i_will_throw_stacktrace_exception(); }
void foo_stacktrace() { bar_stacktrace(); }
TEST(ExceptionsTest, ThrowBasicAndStackExceptions) {
ASSERT_THROW(foo(), utils::BasicException);
ASSERT_THROW(foo_stacktrace(), utils::StacktraceException);
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}