Skip to content

Commit 8f4500b

Browse files
committed
fix(testing): test macros return a single node, so that we can use them in functions like (fun () (test:expect false))
1 parent 036f950 commit 8f4500b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Testing.ark

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@
197197
# (test:expect (return_true) "return true"})
198198
# =end
199199
# @author https://github.com/SuperFola
200-
(macro test:expect (_cond ..._desc) {
200+
(macro test:expect (_cond ..._desc) {{
201201
(mut _cond_res ($as-is _cond))
202202
(if (!= true _cond_res)
203203
(testing:_report_error true _cond_res "true" ($repr _cond) _desc)
204-
(testing:_report_success)) })
204+
(testing:_report_success)) }})
205205

206206
# @brief Compare two values that should be equal and generate a test case
207207
# @param _expr computed value to test
@@ -213,12 +213,12 @@
213213
# (test:eq 5 (foo) "foo should return 5")})
214214
# =end
215215
# @author https://github.com/SuperFola
216-
(macro test:eq (_expr _expected ..._desc) {
216+
(macro test:eq (_expr _expected ..._desc) {{
217217
(mut _expected_res ($as-is _expected))
218218
(mut _expr_res ($as-is _expr))
219219
(if (= _expected_res _expr_res)
220220
(testing:_report_success)
221-
(testing:_report_error _expected_res _expr_res ($repr _expected) ($repr _expr) _desc)) })
221+
(testing:_report_error _expected_res _expr_res ($repr _expected) ($repr _expr) _desc)) }})
222222

223223
# @brief Compare two values that should **not** be equal and generate a test case
224224
# @param _value tested value
@@ -229,12 +229,12 @@
229229
# (test:neq 0 (my_function 1 2 3))})
230230
# =end
231231
# @author https://github.com/SuperFola
232-
(macro test:neq (_value _unexpected ..._desc) {
232+
(macro test:neq (_value _unexpected ..._desc) {{
233233
(mut _unexpected_res ($as-is _unexpected))
234234
(mut _value_res ($as-is _value))
235235
(if (!= _unexpected_res _value_res)
236236
(testing:_report_success)
237-
(testing:_report_error _unexpected_res _value_res ($repr _unexpected) ($repr _value) _desc)) })
237+
(testing:_report_error _unexpected_res _value_res ($repr _unexpected) ($repr _value) _desc)) }})
238238

239239
# @brief Generate the code for a test suite
240240
# @details Create two variables: _name-output (a list: [successes, failures]) and _name-status (boolean, true on success)

0 commit comments

Comments
 (0)