@@ -63,20 +63,20 @@ class ClassDescription : public Description {
63
63
64
64
const bool has_subject = true ;
65
65
66
- bool it (std::string descr, std::function<void (ItCd<T>&)> body);
67
- bool it (std::function<void (ItCd<T>&)> body);
68
- bool context (T subject, block_t body);
69
- bool context (T& subject, block_t body);
70
- bool context (block_t body);
71
- bool run ();
66
+ Result it (std::string descr, std::function<void (ItCd<T>&)> body);
67
+ Result it (std::function<void (ItCd<T>&)> body);
68
+ Result context (T subject, block_t body);
69
+ Result context (T& subject, block_t body);
70
+ Result context (block_t body);
71
+ Result run () override ;
72
72
};
73
73
74
74
template <class T >
75
75
using ClassContext = ClassDescription<T>;
76
76
77
77
template <class T >
78
- bool ClassDescription<T>::context(T subject,
79
- std::function<void (ClassDescription&)> body) {
78
+ Result ClassDescription<T>::context(T subject,
79
+ std::function<void (ClassDescription&)> body) {
80
80
ClassContext<T> context (subject, body);
81
81
context.set_parent (this );
82
82
context.before_eaches = this ->before_eaches ;
@@ -85,13 +85,13 @@ bool ClassDescription<T>::context(T subject,
85
85
}
86
86
87
87
template <class T >
88
- bool ClassDescription<T>::context(T& subject,
88
+ Result ClassDescription<T>::context(T& subject,
89
89
std::function<void (ClassDescription&)> body) {
90
90
return context (subject, body);
91
91
}
92
92
93
93
template <class T >
94
- bool ClassDescription<T>::context(std::function<void (ClassDescription&)> body) {
94
+ Result ClassDescription<T>::context(std::function<void (ClassDescription&)> body) {
95
95
ClassContext<T> context (body);
96
96
context.set_parent (this );
97
97
context.before_eaches = this ->before_eaches ;
@@ -100,8 +100,8 @@ bool ClassDescription<T>::context(std::function<void(ClassDescription&)> body) {
100
100
}
101
101
102
102
template <class T >
103
- bool Description::context (T subject,
104
- std::function<void (ClassDescription<T>&)> body) {
103
+ Result Description::context (T subject,
104
+ std::function<void (ClassDescription<T>&)> body) {
105
105
ClassContext<T> context (body);
106
106
context.subject = subject;
107
107
context.set_parent (this );
@@ -117,7 +117,7 @@ bool Description::context(T subject,
117
117
// }
118
118
119
119
template <class T , typename U>
120
- bool Description::context (std::initializer_list<U> init_list,
120
+ Result Description::context (std::initializer_list<U> init_list,
121
121
std::function<void (ClassDescription<T>&)> body) {
122
122
ClassContext<T> context (T (init_list), body);
123
123
context.set_parent (this );
@@ -148,10 +148,10 @@ bool Description::context(std::initializer_list<U> init_list,
148
148
* @return the result of the test
149
149
*/
150
150
template <class T >
151
- bool ClassDescription<T>::it(std::string name,
151
+ Result ClassDescription<T>::it(std::string name,
152
152
std::function<void (ItCd<T>&)> body) {
153
153
ItCd<T> it (*this , this ->subject , name, body);
154
- bool result = it.run ();
154
+ Result result = it.run ();
155
155
exec_after_eaches ();
156
156
exec_before_eaches ();
157
157
return result;
@@ -179,20 +179,20 @@ bool ClassDescription<T>::it(std::string name,
179
179
* @return the result of the test
180
180
*/
181
181
template <class T >
182
- bool ClassDescription<T>::it(std::function<void (ItCd<T>&)> body) {
182
+ Result ClassDescription<T>::it(std::function<void (ItCd<T>&)> body) {
183
183
ItCd<T> it (*this , this ->subject , body);
184
- bool result = it.run ();
184
+ Result result = it.run ();
185
185
exec_after_eaches ();
186
186
exec_before_eaches ();
187
187
return result;
188
188
}
189
189
190
190
template <class T >
191
- bool ClassDescription<T>::run() {
191
+ Result ClassDescription<T>::run() {
192
192
std::cout << padding () << descr << std::endl;
193
193
body (*this );
194
194
std::cout << std::endl;
195
- return this ->get_status ();
195
+ return Result ( this ->get_status () );
196
196
}
197
197
198
198
template <class T >
@@ -203,14 +203,14 @@ Expectations::Expectation<T> ItCd<T>::is_expected() {
203
203
}
204
204
205
205
template <class T >
206
- bool ItCd<T>::run() {
206
+ Result ItCd<T>::run() {
207
207
if (!this ->needs_descr ()) {
208
208
std::cout << padding () << get_descr () << std::endl;
209
209
}
210
210
body (*this );
211
211
auto cd = static_cast <ClassDescription<T>*>(this ->get_parent ());
212
212
cd->reset_lets ();
213
- return this ->get_status ();
213
+ return Result ( this ->get_status () );
214
214
}
215
215
216
216
#endif /* CLASS_DESCRIPTION_H */
0 commit comments