22class Description :
public Runnable {
23 using VoidBlock = std::function<void()>;
26 using Block = std::function<void(Description&)>;
28 std::forward_list<LetBase*> lets;
29 std::deque<VoidBlock> after_alls;
30 std::deque<VoidBlock> before_eaches;
31 std::deque<VoidBlock> after_eaches;
35 std::list<std::unique_ptr<LetBase>> owned_lets_;
38 std::string description;
40 void exec_before_eaches();
41 void exec_after_eaches();
45 Description(
const char* description,
47 std::source_location location = std::source_location::current()) noexcept
48 : Runnable(location), block(std::move(block)), description(description) {
49 this->set_location(location);
52 Description(std::source_location location, std::string&& description) noexcept
53 : Runnable(location), description(std::move(description)) {}
55 Description(std::source_location location,
const char* description, Block block) noexcept
56 : Runnable(location), block(std::move(block)), description(description) {}
60 ItD& it(
const char* name, ItD::Block body, std::source_location location = std::source_location::current());
61 ItD& it(ItD::Block body, std::source_location location = std::source_location::current());
65 template <
class T = std::
nullptr_t>
66 Description& context(
const char* description,
68 std::source_location location = std::source_location::current());
70 template <Util::not_c_
string T,
class B>
71 ClassDescription<T>& context(T& subject, B block, std::source_location location = std::source_location::current());
73 template <
class T,
class B>
77 std::source_location location = std::source_location::current());
79 template <Util::not_c_
string T,
class B>
80 ClassDescription<T>& context(T&& subject, B block, std::source_location location = std::source_location::current());
82 template <
class T,
class B>
86 std::source_location location = std::source_location::current());
88 template <
class T,
typename U>
91 std::source_location location = std::source_location::current());
95 void before_each(VoidBlock block);
96 void before_all(VoidBlock block);
97 void after_each(VoidBlock block);
98 void after_all(VoidBlock block);
102 template <
typename F>
103 auto& let(F factory);
104 void reset_lets()
noexcept;
108 [[nodiscard]]
virtual std::string get_description()
const noexcept {
return description; }
109 [[nodiscard]]
virtual std::string get_subject_type()
const noexcept {
return ""; }
115 template <
typename Formatter>
116 inline auto as_main();
144inline Context& Description::context(
const char* description, Block body, std::source_location location) {