Skip to content

Commit c579744

Browse files
committed
feat: using $paste in Testing.ark to stop recursive macro evaluation
1 parent aae15fe commit c579744

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Testing.ark

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@
139139
# =end
140140
# @author https://github.com/SuperFola
141141
($ test:expect (_cond ..._desc) {
142-
(if (!= true _cond)
143-
(_report_error true _cond "true" ($repr _cond) _desc)
142+
(if (!= true ($paste _cond))
143+
(_report_error true ($paste _cond) "true" ($repr _cond) _desc)
144144
(_report_success))})
145145

146146
# @brief Compare two values that should be equal and generate a test case
@@ -154,9 +154,9 @@
154154
# =end
155155
# @author https://github.com/SuperFola
156156
($ test:eq (_expected _expr ..._desc) {
157-
(if (= _expected _expr)
157+
(if (= ($paste _expected) ($paste _expr))
158158
(_report_success)
159-
(_report_error _expected _expr ($repr _expected) ($repr _expr) _desc))})
159+
(_report_error ($paste _expected) ($paste _expr) ($repr _expected) ($repr _expr) _desc))})
160160

161161
# @brief Compare two values that should **not** be equal and generate a test case
162162
# @param _unexpected the value we don't want
@@ -168,9 +168,9 @@
168168
# =end
169169
# @author https://github.com/SuperFola
170170
($ test:neq (_unexpected _value ..._desc) {
171-
(if (!= _unexpected _value)
171+
(if (!= ($paste _unexpected) ($paste _value))
172172
(_report_success)
173-
(_report_error _unexpected _value ($repr _unexpected) ($repr _value) _desc))})
173+
(_report_error ($paste _unexpected) ($paste _value) ($repr _unexpected) ($repr _value) _desc))})
174174

175175
# @brief Generate the code for a test suite
176176
# @details Create two variables: _name-output (a list: [successes, failures]) and _name-status (boolean, true on success)
@@ -184,5 +184,5 @@
184184
# =end
185185
# @author https://github.com/SuperFola
186186
($ test:suite (_name _body) {
187-
(let (symcat _name "-output") (_runner ($repr _name) (fun () {_body})))
187+
(let (symcat _name "-output") (_runner ($repr _name) (fun () ($paste {_body}))))
188188
(let (symcat _name "-status") (= 0 (@ (symcat _name "-output") 1)))})

0 commit comments

Comments
 (0)