OTest2
A C++ testing framework
internalerror.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Ondrej Starek
3  *
4  * This file is part of OTest2.
5  *
6  * OTest2 is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License,
9  * or (at your option) any later version.
10  *
11  * OTest2 is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with OTest2. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #include <internalerror.h>
20 
21 #include <assertstream.h>
22 #include <context.h>
23 #include <reporter.h>
24 #include <semanticstack.h>
25 
26 namespace OTest2 {
27 
29  const Context& context_,
30  const std::string& message_) noexcept {
31  /* -- fail the test */
32  context_.semantic_stack->setTop(false);
33  /* -- report the failure */
34  AssertStream report_(
35  context_, context_.reporter->enterError(context_), false, {});
36  report_ << message_ << commitMsg();
37 }
38 
39 } /* -- namespace OTest2 */
assertstream.h
reporter.h
OTest2::commitMsg
Private::Manipulator commitMsg()
Commit current assertion message.
Definition: assertstream.cpp:201
internalerror.h
OTest2::internalError
void internalError(const Context &context_, const std::string &message_) noexcept
Fail the running test because of an internal error.
Definition: internalerror.cpp:28
semanticstack.h
OTest2
Definition: assertbean.h:25
context.h
OTest2::Context
OTest2 runtime context.
Definition: context.h:38
OTest2::AssertStream
Assertion stream.
Definition: assertstream.h:40